First commit

This commit is contained in:
Tammo ter Hark 2026-06-17 10:06:07 +02:00
commit b7fcf64bbf
2 changed files with 2180 additions and 0 deletions

328
options/options.js Normal file
View file

@ -0,0 +1,328 @@
var ThemeOptions = function(){
var ThemeOptions = function () {
'use strict';
//////////////////
// Define necessary globals
// general_inherit_active is not present at global level
// see: https://github.com/LimeSurvey/LimeSurvey/blob/1cbfa11b081f54763b28364472926b155efea5dc/themes/survey/vanilla/options/options.twig#L71
var inheritPossible = ($('#general_inherit_active').length > 0);
//get option Object from Template configuration options
var optionObject = {'general_inherit': 1};
//get the global form
var globalForm = $('.action_update_options_string_form');
/////////////////
// Define methods run on startup
// #TemplateConfiguration_options is the id of the Options field in advanced option
// getter for generalInherit
var generalInherit = function () {
return $('#TemplateConfiguration_options').val() === 'inherit';
};
//parse the options as set in the advanced form
var parseOptionObject = function () {
// If no general inherit, then pass the value of the "Options" field in advanced option to the object optionObject
if ($('#TemplateConfiguration_options').length > 0 && !generalInherit()) {
try {
optionObject = JSON.parse($('#TemplateConfiguration_options').val());
} catch (e) {
console.ls ? console.ls.error('No valid option field!') : console.log('No valid option field!');
}
}
};
// Show/Hide fields on generalInherit
// To hide a simple option on generalInherit: just add the class "action_hide_on_inherit" to the rows continaing it
var startupGeneralInherit = function () {
if (!inheritPossible) return false;
if (generalInherit()) {
$('#general_inherit_on').prop('checked', true).trigger('change').closest('label').addClass('active');
$('.action_hide_on_inherit').addClass('d-none');
} else {
$('#general_inherit_off').prop('checked', true).trigger('change').closest('label').addClass('active');
}
};
// So this function find the selectors in the forum, and pass their values to the advanced options
var updateFieldSettings = function () {
if ($('#general_inherit_on').prop('checked')) {
$('#TemplateConfiguration_options').val('inherit');
return;
}
globalForm.find('.selector_option_value_field').each(function (i, item) {
//disabled items should be inherit or false
if ($(item).prop('disabled')) {
$(item).val((inheritPossible ? 'inherit' : false));
}
optionObject[$(item).attr('name')] = $(item).val();
});
globalForm.find('.selector_option_radio_field ').each(function (i, item) {
//disabled items should be inherit or false
if ($(item).prop('disabled')) {
$(item).val((inheritPossible ? 'inherit' : false));
}
if ($(item).attr('type') == 'radio') {
if ($(item).prop('checked')) {
optionObject[$(item).attr('name')] = $(item).val();
}
}
});
var newOptionObject = $.extend(true, {}, optionObject);
delete newOptionObject.general_inherit;
$('#TemplateConfiguration_options').val(JSON.stringify(newOptionObject));
};
///////////////
// Utility Methods
// -- small utilities i.g. for images or similar, or very specialized functions
//Parses the option value for an item
var parseOptionValue = function (item, fallbackValue) {
fallbackValue = fallbackValue || false;
// If general inherit, then the value of the dropdown is inherit, else it's the value defined in advanced options
var itemValue = generalInherit() ? 'inherit' : optionObject[$(item).attr('name')];
// If anything goes wrong (manual edit or anything else), we make sure it will have a correct value
if (itemValue == null || itemValue == undefined) {
itemValue = inheritPossible ? 'inherit' : fallbackValue;
optionObject[$(item).attr('name')] = itemValue;
}
return itemValue;
};
//Set value and propagate to bootstrapSwitch
var setAndPropageteToSwitch = function (item) {
$(item).prop('checked', true).trigger('change');
$(item).closest('label').addClass('active');
};
///////////////
// Parser methods
// -- These methods will either parse through existing fields, or set existing fields to their correct values
// Update values in the form to the template options
// selector_option_value_field are the select dropdown (like variations and fonts)
var prepareSelectField = function () {
globalForm.find('.selector_option_value_field').each(function (i, item) {
var itemValue = parseOptionValue(item);
$(item).val(itemValue);
});
};
// Generate the state of switches (On/Off/Inherit)
var parseParentSwitchFields = function () {
globalForm.find('.selector_option_radio_field').each(function (i, item) {
var itemValue = parseOptionValue(item, 'off');
//if it is a radio selector, check it and propagate the change to bootstrapSwitch
if ($(item).val() == itemValue) {
setAndPropageteToSwitch(item);
}
});
};
var prepareFontField = function () {
optionObject.font = optionObject.font || (inheritPossible ? 'inherit' : 'roboto');
if (optionObject.font !== 'inherit') {
$('#simple_edit_options_font').val(optionObject.font);
}
updateFieldSettings();
};
///////////////
// HotSwap methods
// -- These methods connect an input directly to the value in the optionsObject
// Disable dependent inputs when their parents are set to off, or inherit
var hotSwapParentRadioButtons = function () {
// hotswapping the select fields to the radiobuttons
// If an option is set to off, the attached selectors are disabled
$('.selector_radio_childfield').each(function (i, selectorItem) {
$('input[name=' + $(selectorItem).data('parent') + ']').on('change', function () {
if ($(this).val() === 'on' && $(this).prop('checked') == true) {
$(selectorItem).prop('disabled', false);
} else {
$(selectorItem).prop('disabled', true);
}
// disabled this part to always be able to click on "Preview image" button
/*
if ($(selectorItem).hasClass('selector_image_selector')) {
$('button[data-target="#' + $(selectorItem).attr('id') + '"]').prop('disabled', $(selectorItem).val() == 'inherit');
}
*/
});
});
};
// hotswapping the fields
var hotSwapFields = function () {
globalForm.find('.selector_option_value_field').on('change', function (evt) {
updateFieldSettings();
});
globalForm.find('.selector_option_radio_field').on('change', updateFieldSettings);
};
var hotswapGeneralInherit = function () {
//hotswapping the general inherit
$('#general_inherit_on').on('change', function (evt) {
$('#TemplateConfiguration_options').val('inherit');
$('.action_hide_on_inherit').addClass('d-none');
});
$('#general_inherit_off').on('change', function (evt) {
$('.action_hide_on_inherit').removeClass('d-none');
updateFieldSettings();
});
};
var hotswapFontField = function () {
$('#simple_edit_options_font').on('change', function (evt) {
var currentPackageObject = $('#TemplateConfiguration_packages_to_load').val() !== 'inherit'
? JSON.parse($('#TemplateConfiguration_packages_to_load').val())
: $(this).data('inheritvalue');
if ($('#simple_edit_options_font').val() === 'inherit') {
$('#TemplateConfiguration_packages_to_load').val('inherit');
} else {
var selectedFontPackage = $(this).find('option:selected');
var packageName = selectedFontPackage.data('font-package');
var formatedPackageName = 'font-' + packageName;
var filteredAdd = currentPackageObject.add.filter(function (value, index) {
return !(/^font-.*$/.test(String(value)));
});
filteredAdd.push(formatedPackageName);
currentPackageObject.add = filteredAdd;
$('#TemplateConfiguration_packages_to_load').val(JSON.stringify(currentPackageObject));
}
});
};
///////////////
// Event methods
// -- These methods are triggered on events. Please see `bind´ method for more information
var onSaveButtonClickAction = function (evt) {
evt.preventDefault();
if (generalInherit()) {
$('#TemplateConfiguration_options').val('inherit');
$('#template-options-form').trigger('submit'); // submit the form
} else {
//Create a copy of the inherent optionObject
var newOptionObject = $.extend(true, {}, optionObject);
newOptionObject.generalInherit = null;
// Now write the newly created object to the correspondent field as a json string
$('#TemplateConfiguration_options').val(JSON.stringify(newOptionObject));
// And submit the form
// Beware, we are triggering 'submit' directly, which doesn't trigger HTML5 validations.
// No HTML5 validations needed here, so all good.
// If not we would need to add a hidden submit button and trigger a 'click' on it. (see fruity theme).
// Like these: $('#template-options-form').find('button[type=submit]').trigger('click');
$('#template-options-form').trigger('submit');
}
};
///////////////
// Instance methods
var bind = function () {
//if the save button is clicked write everything into the template option field and send the form
$('.action_update_options_string_button, #theme-options--submit').on('click', onSaveButtonClickAction);
//Bind the hotwaps
hotSwapParentRadioButtons();
hotSwapFields();
hotswapGeneralInherit();
hotswapFontField();
};
var run = function () {
parseOptionObject();
startupGeneralInherit();
prepareSelectField();
parseParentSwitchFields();
prepareFontField();
bind();
};
return run;
};
var prepare = function () {
var deferred = $.Deferred();
//activate the bootstrap switch for checkboxes
$('.action_activate_bootstrapswitch').bootstrapSwitch();
var themeOptionStarter = new ThemeOptions();
themeOptionStarter();
setTimeout(function () {
deferred.resolve();
}, 650);
return deferred.promise();
};
$(document).off('pjax:scriptcomplete.templateOptions').on('ready pjax:scriptcomplete.templateOptions', function () {
$('.simple-template-edit-loading').css('display', 'block');
prepare().then(function (runsesolve) {
$('.simple-template-edit-loading').css('display', 'none');
});
$('.selector__open_lightbox').on('click', function (e) {
e.preventDefault();
var imgSrc = $($(this).data('bs-target')).find('option:selected').data('lightbox-src');
var imgTitle = $($(this).data('bs-target')).val();
imgTitle = imgTitle.split('/').pop();
$('#lightbox-modal').find('.selector__title').text(imgTitle);
$('#lightbox-modal').find('.selector__image').attr({'src': imgSrc, 'alt': imgTitle});
$('#lightbox-modal').modal('show');
});
var uploadImageBind = new bindUpload({
form: '#upload_frontend',
input: '#upload_image_frontend',
progress: '#upload_progress_frontend',
onBeforeSend: function () {
$('.simple-template-edit-loading').css('display', 'block');
},
onSuccess: function () {
setTimeout(function () {
$(document).trigger('pjax:load', {url: window.location.href});
}, 2500);
}
});
});

427
options/options.twig Normal file
View file

@ -0,0 +1,427 @@
{#
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.
(¯`·._.·(¯`·._.· Default survey template options ._.·´¯)·._.·´¯)
This is the form for the option parameters of the basic default template.
#}
{{ registerPackage('font-roboto') }}
{{ registerPackage('font-noto') }}
{{ registerPackage('font-news_cycle') }}
{{ registerPackage('font-ubuntu') }}
{{ registerPackage('font-lato') }}
{{ registerPackage('font-websafe') }}
{# The default template offers the variety of styles #}
{% set fontOptions = '' %}
{% set brandlogofileOptions , brandlogofileInheritFilename, brandlogofileInheritPreview = '', '', '' %}
{% set secondlogofileOptions , secondlogofileInheritFilename, secondlogofileInheritPreview = '', '', '' %}
{# For surveyspecific settings add an inherit option #}
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
{% set fontOptions = fontOptions ~ '<option value="inherit">'~ gT("Inherit") ~' ( '~ gT("Inherited value:")~' '~ oParentOptions.font ~' )</option>' %}
{% endif %}
{% set fontOptions %}
{{fontOptions}}
<optgroup label="{{ gT("Local Server") }}">
<option class="font-roboto" value="roboto" data-font-package="roboto" >Roboto</option>
<option class="font-news_cycle" value="news_cycle" data-font-package="news_cycle" >News Cycle</option>
<option class="font-lato" value="lato" data-font-package="lato" >Lato</option>
<option class="font-noto" value="noto" data-font-package="noto" >Noto Sans</option>
<option class="font-ubuntu" value="ubuntu" data-font-package="ubuntu" >Ubuntu</option>
</optgroup>
<optgroup label="{{ gT("User browser") }}">
<option class="font-georgia " value="georgia" data-font-package="websafe" >Georgia</option>
<option class="font-palatino " value="palatino" data-font-package="websafe" >Palatino Linotype</option>
<option class="font-times_new_roman " value="times_new_roman" data-font-package="websafe" >Times New Roman</option>
<option class="font-arial " value="arial" data-font-package="websafe" >Arial</option>
<option class="font-arial_black " value="arial_black" data-font-package="websafe" >Arial Black</option>
<option class="font-comic_sans " value="comic_sans" data-font-package="websafe" >Comic Sans</option>
<option class="font-impact " value="impact" data-font-package="websafe" >Impact</option>
<option class="font-lucida_sans " value="lucida_sans" data-font-package="websafe" >Lucida Sans</option>
<option class="font-trebuchet " value="trebuchet" data-font-package="websafe" >Trebuchet</option>
<option class="font-courier " value="courier" data-font-package="websafe" >Courier New</option>
<option class="font-lucida_console " value="lucida_console" data-font-package="websafe" >Lucida Console</option>
</optgroup>
{% endset %}
<div class="container-fluid" style="position:relative">
{# Small loading animation to give the scripts time to parse and render the correct values #}
<div class="" style="display:none;height:100%;width:100%;position:absolute;left:0;top:0;background:rgb(255,255,255);background:rgba(235,235,235,0.8);z-index:2000;">
<div style="position:absolute; left:49%;top:35%;" class="text-center">
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
</div>
</div>
<div class="row">
{# Begin template option form #}
<form class='form action_update_options_string_form' action=''>
{# If this is a surveyspecific settings page, offer the possibility to do a full inheritance of the parent template #}
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<div class='row' id="general_inherit_active">
<div class='mb-3 row'>
<label for='simple_edit_options_general_inherit' class='control-label'>{{gT("Inherit everything" )}}</label>
<div class='col-12'>
<div class="btn-group" data-bs-toggle="buttons">
<label class="btn btn-outline-secondary">
<input id="general_inherit_on" name='general_inherit' type='radio' value='on' class='selector_option_general_inherit ' data-id='simple_edit_options_general_inherit'/>
{{ gT("Yes") }}
</label>
<label class="btn btn-outline-secondary">
<input id="general_inherit_off" name='general_inherit' type='radio' value='off' class='selector_option_general_inherit ' data-id='simple_edit_options_general_inherit'/>
{{ gT("No") }}
</label>
</div>
</div>
</div>
</div>
<div class="row action_hide_on_inherit">
<hr/>
</div>
{% endif %}
{# First settings row #}
<div class='row action_hide_on_inherit'>
{# Container #}
<div class='col-12 col-lg-4 col-xl-3'>
<div class='mb-3 row'>
<label for='simple_edit_options_container' class='control-label'> {{ gT("Survey container") }} </label>
<div class='col-12'>
<div class="btn-group" data-bs-toggle="buttons">
<label class="btn btn-outline-secondary">
<input type='radio' name='container' value='on' class='selector_option_radio_field simple_edit_options_container ' data-id='container'/>
{{ gT("Yes") }}
</label>
<label class="btn btn-outline-secondary">
<input type='radio' name='container' value='off' class='selector_option_radio_field simple_edit_options_container ' data-id='container'/>
{{ gT("No") }}
</label>
{# If this is a root template setting, don't show the inherit button #}
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<label class="btn btn-outline-secondary">
<input type='radio' name='container' value='inherit' class='selector_option_radio_field simple_edit_options_container ' data-id='container'/>
{{ gT("Inherit") }} [{{ oParentOptions.brandlogo }}]
</label>
{% endif %}
</div>
</div>
</div>
</div>
{# hideprivacyinfo #}
<div class='col-12 col-lg-4 col-xl-3'>
<div class='mb-3 row'>
<label for='simple_edit_options_hideprivacyinfo' class='control-label'>{{ gT("Hide privacy info") }}</label>
<div class='col-12'>
<div class="btn-group" data-bs-toggle="buttons">
<label class="btn btn-outline-secondary">
<input type='radio' name='hideprivacyinfo' value='on' class='selector_option_radio_field simple_edit_options_hideprivacyinfo ' data-id='hideprivacyinfo'/>
{{ gT("Yes") }}
</label>
<label class="btn btn-outline-secondary">
<input type='radio' name='hideprivacyinfo' value='off' class='selector_option_radio_field simple_edit_options_hideprivacyinfo ' data-id='hideprivacyinfo'/>
{{ gT("No") }}
</label>
{# If this is a root template setting, don't show the inherit button #}
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<label class="btn btn-outline-secondary">
<input type='radio' name='hideprivacyinfo' value='inherit' class='selector_option_radio_field simple_edit_options_hideprivacyinfo ' data-id='hideprivacyinfo'/>
{{ gT("Inherit") }} [{{ oParentOptions.brandlogo }}]
</label>
{% endif %}
</div>
</div>
</div>
</div>
{# Show Clear And Exit #}
<div class='col-12 col-lg-4 col-xl-3'>
<div class='mb-3 row'>
<label for='simple_edit_options_showclearall' class='control-label'> {{ gT("Show link/button to delete response & exit survey") }} </label>
<div class='col-12'>
<div class="btn-group" data-bs-toggle="buttons">
<label class="btn btn-outline-secondary">
<input type='radio' name='showclearall' value='on' class='selector_option_radio_field simple_edit_options_showclearall ' data-id='showclearall'/>
{{ gT("Yes") }}
</label>
<label class="btn btn-outline-secondary">
<input type='radio' name='showclearall' value='off' class='selector_option_radio_field simple_edit_options_showclearall ' data-id='showclearall'/>
{{ gT("No") }}
</label>
{# If this is a root template setting, don't show the inherit button #}
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<label class="btn btn-outline-secondary" title="{{ gT("Inherited value:") }} ">
<input type='radio' name='showclearall' value='inherit' class='selector_option_radio_field simple_edit_options_showclearall ' data-id='showclearall'/>
{{ gT("Inherit") }} [{{ oParentOptions.showclearall }}]
</label>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{# Second settings row #}
<div class='row action_hide_on_inherit'>
{# questionhelptextposition #}
<div class='col-12 col-lg-4 col-xl-3'>
<div class='mb-3 row'>
<label for='simple_edit_options_questionhelptextposition' class='control-label'>{{ gT("Question help text position") }}</label>
<div class='col-12'>
<div class="btn-group" data-bs-toggle="buttons">
<label class="btn btn-outline-secondary">
<input type='radio' name='questionhelptextposition' value='top' class='selector_option_radio_field simple_edit_options_questionhelptextposition ' data-id='questionhelptextposition'/>
{{ gT("Top") }}
</label>
<label class="btn btn-outline-secondary">
<input type='radio' name='questionhelptextposition' value='bottom' class='selector_option_radio_field simple_edit_options_questionhelptextposition ' data-id='questionhelptextposition'/>
{{ gT("Bottom") }}
</label>
{# If this is a root template setting, don't show the inherit button #}
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<label class="btn btn-outline-secondary">
<input type='radio' name='questionhelptextposition' value='inherit' class='selector_option_radio_field simple_edit_options_questionhelptextposition ' data-id='questionhelptextposition'/>
{{ gT("Inherit") }} [{{ oParentOptions.questionhelptextposition }}]
</label>
{% endif %}
</div>
</div>
</div>
</div>
{# Show popups #}
<div class='col-12 col-lg-4 col-xl-4'>
<div class='mb-3 row'>
<label for='simple_edit_options_showpopups' class='control-label' {{ showpopups_disabled_qtip }}>{{ gT("Show popups") }}</label>
<div class='col-12'>
<div class="btn-group" data-bs-toggle="buttons">
<label class="btn btn-outline-secondary control-label" {{ showpopups_disabled }}>
<input type='radio' name='showpopups' value='1' {{ showpopups_disabled }} class='selector_option_radio_field simple_edit_options_showpopups ' data-id='showpopups'/>
{{ gT("Popup") }}
</label>
<label class="btn btn-outline-secondary" {{ showpopups_disabled }}>
<input type='radio' name='showpopups' value='0' {{ showpopups_disabled }} class='selector_option_radio_field simple_edit_options_showpopups ' data-id='showpopups'/>
{{ gT("On page") }}
</label>
<label class="btn btn-outline-secondary" {{ showpopups_disabled }}>
<input type='radio' name='showpopups' value='-1' {{ showpopups_disabled }} class='selector_option_radio_field simple_edit_options_showpopups ' data-id='showpopups'/>
{{ gT("No") }}
</label>
{# If this is a root template setting, don't show the inherit button #}
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<label class="btn btn-outline-secondary" {{ showpopups_disabled }}>
<input type='radio' name='showpopups' value='inherit' class='selector_option_radio_field simple_edit_options_showpopups ' data-id='showpopups'/>
{{ gT("Inherit") }} [{{ oParentOptions.showpopups }}]
</label>
{% endif %}
</div>
</div>
</div>
</div>
{# Fix num auto (and real num value) #}
<div class='col-12 col-lg-4 col-xl-3'>
<div class='mb-3 row'>
<label for='simple_edit_options_fixnumauto' class='control-label'>{{ gT("Fix automatically numeric value") }}</label>
<div class='col-12'>
<div class="btn-group" data-bs-toggle="buttons">
<label class="btn btn-outline-secondary">
{# bFixNumAuto : 1 and bNumRealValue : 0 #}
<input type='radio' name='fixnumauto' value='enable' class='selector_option_radio_field simple_edit_options_fixnumauto' data-id='fixnumauto'/>
{{ gT("Yes") }}
</label>
<label class="btn btn-outline-secondary">
{# bFixNumAuto : 0 and bNumRealValue : 0 #}
<input type='radio' name='fixnumauto' value='partial' class='selector_option_radio_field simple_edit_options_fixnumauto' data-id='fixnumauto'/>
{{ gT("For expression") }}
</label>
<label class="btn btn-outline-secondary">
{# bFixNumAuto : 0 and bNumRealValue : 1 #}
<input type='radio' name='fixnumauto' value='disable' class='selector_option_radio_field simple_edit_options_fixnumauto' data-id='fixnumauto'/>
{{ gT("No") }}
</label>
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<label class="btn btn-outline-secondary">
<input type='radio' name='fixnumauto' value='inherit' class='selector_option_radio_field simple_edit_options_fixnumauto' data-id='fixnumauto'/>
{{ gT("Inherit") }} [{{ oParentOptions.fixnumauto == gT("No") ? gT("Default") : oParentOptions.fixnumauto }}]
</label>
{% else %}
{# Since added after theme distribution and don't want reset : use empty value for leave default #}
<label class="btn btn-outline-secondary">
<input type='radio' name='fixnumauto' value='off' class='selector_option_radio_field simple_edit_options_fixnumauto' data-id='fixnumauto'/>
{{ gT("Default") }}
</label>
{% endif %}
</div>
</div>
</div>
</div>
</div>
<div class='row action_hide_on_inherit'>
<hr/>
</div>
<!-- Brand Logo -->
<div class='row action_hide_on_inherit'>
<div class='col-12 col-lg-4'>
{# Brandlogo #}
<div class='mb-3 row'>
<label for='simple_edit_options_brandlogo' class='control-label'>Brandlogo</label>
<div class='col-12'>
<div class="btn-group" data-bs-toggle="buttons">
<label class="btn btn-outline-secondary">
<input type='radio' name='brandlogo' value='on' class='selector_option_radio_field ' data-id='simple_edit_options_brandlogo'/>
{{gT("Yes" )}}
</label>
<label class="btn btn-outline-secondary">
<input type='radio' name='brandlogo' value='off' class='selector_option_radio_field ' data-id='simple_edit_options_brandlogo'/>
{{ gT("No") }}
</label>
{# If this is a root template setting, don't show the inherit button #}
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<label class="btn btn-outline-secondary">
<input type='radio' name='brandlogo' value='inherit' class='selector_option_radio_field ' data-id='simple_edit_options_brandlogo'/>
{{ gT("Inherit") }} [{{ oParentOptions.brandlogo }}]
</label>
{% endif %}
</div>
</div>
</div>
</div>
<div class='col-md-8 col-lg-6'>
{# Brandlogo file selector #}
<div class='mb-3 row'>
<label for='simple_edit_options_brandlogofile' class='control-label'>Brandlogo file</label>
<div class='col-12'>
<select class='form-select selector_option_value_field selector_radio_childfield selector_image_selector' data-parent="brandlogo" id='simple_edit_options_brandlogofile' name='brandlogofile'>
{% set optgroup = '' %}
{% for image in templateConfiguration.imageFileList %}
{% if image.group != optgroup %}
{% if optgroup != '' %}
{% set brandlogofileOptions = brandlogofileOptions ~ '</optgroup>' %}
{% endif %}
{% set brandlogofileOptions = brandlogofileOptions ~ '<optgroup label="' ~ image.group ~ '">' %}
{% set optgroup = image.group %}
{% endif %}
{% if oParentOptions.brandlogofile == image.filepath %}
{% set brandlogofileInheritPreview = brandlogofileInheritPreview ~ image.preview %}
{% set brandlogofileInheritFilename = brandlogofileInheritFilename ~ image.filename %}
{% endif %}
{% set brandlogofileOptions = brandlogofileOptions ~ '<option data-lightbox-src="' ~ image.preview ~ '" value="' ~ image.filepath ~ '">' ~ image.filename ~ '</option>' %}
{% endfor %}
{% set brandlogofileOptions = brandlogofileOptions ~ '</optgroup>' %}
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
{% set brandlogofileOptions = '<option data-lightbox-src="' ~ brandlogofileInheritPreview ~ '" value="inherit">' ~ gT("Inherit")~ ' [' ~ gT("inherited value:") ~ ' ' ~ brandlogofileInheritFilename ~ ']</option>' ~ brandlogofileOptions %}
{% endif %}
{{ brandlogofileOptions }}
</select>
</div>
</div>
</div>
<div class='col-md-4 col-lg-2'>
<br/>
<button class="btn btn-outline-secondary selector__open_lightbox" data-target="#simple_edit_options_brandlogofile"> {{ gT('Preview image')}}</button>
</div>
</div>
<div class='row ls-space margin top-15 bottom-15 '>
<hr/>
</div>
<div class='row'>
<div class='col-12'>
<div class='panel panel-default'>
<div class='panel-heading'>{{ sprintf( gT("%s fonts"), templateConfiguration.template_name)|capitalize }}</div>
<div class='panel-body'>
<div class='mb-3 row'>
<label for='simple_edit_options_font' class='control-label'>{{ gT("Select font:") }}</label>
<div class='col-12'>
<select class='form-select selector_option_value_field' id='simple_edit_options_font' name='font' data-inheritvalue='{{oParentOptions.packages_to_load}}'>
{{ fontOptions }}
</select>
</div>
</div>
</div>
</div>
</div>
</div>
<div class='row d-none'>
<div class='col-12'>
<button class='btn btn-success col-lg-2 col-md-4 col-6 action_update_options_string_button'>
Save
</button>
</div>
</div>
</form>
</div>
<div class='row action_hide_on_inherit'>
{# Upload an image #}
<div class="container-fluid ls-space margin bottom-15">
<div class="row ls-space margin bottom-15">
<div class="col-md-6">
{{ sprintf( gT("Upload an image (maximum size: %d MB):"), (templateConfiguration.maxFileSize/1024/1024) ) }}
</div>
<div class="col-md-6">
{{ C.Html.form(createUrl('/admin/themes/sa/upload'), 'post', { 'id' : 'upload_frontend', 'name' : 'upload_frontend', 'enctype' :'multipart/form-data' }) }}
<span id="fileselector_frontend">
<label class="btn btn-outline-secondary col-8" for="upload_image_frontend">
<input class="d-none" id="upload_image_frontend" name="upload_image_frontend" type="file">
<i class="fa fa-upload ls-space margin right-10"></i>
{{ gT("Upload") }}
</label>
</span>
<input type='hidden' name='surveyid' value='{{ templateConfiguration.sid }}' />
<input type='hidden' name='templatename' value='{{ templateConfiguration.template_name }}' />
<input type='hidden' name='templateconfig' value='{{ templateConfiguration.id }}' />
<input type='hidden' name='action' value='templateuploadimagefile' />
</form>
</div>
</div>
<div class="row">
<div class="progress">
<div id="upload_progress_frontend" class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">
<span class="visually-hidden">0%</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" tabindex="-1" role="dialog" id="lightbox-modal">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
<h4 class="modal-title selector__title"> </h4>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<img class="selector__image img-fluid" src="" alt="title" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>