1
0
mirror of https://github.com/typemill/typemill.git synced 2025-08-01 11:50:28 +02:00

Fixed download controller and errors with publicfielddefinitions

This commit is contained in:
trendschau
2021-11-20 14:23:29 +01:00
parent 6e1e2d1e34
commit 63c8b204d7
5 changed files with 14 additions and 8 deletions

View File

@@ -137,7 +137,7 @@ class ControllerDownload extends ControllerShared
header_remove("Last-Modified");
header('Cache-Control: max-age=0, no-cache, no-store, must-revalidate');
header('Cache-Control: private', false); # required for some browsers
header('Content-Type: application/zip');
header('Content-Type: ' . $mimetype);
header('Content-Disposition: attachment; filename="'.basename($file).'";'); # Make the browser display the Save As dialog
header('Content-Transfer-Encoding: binary');
header('Content-Length: '.filesize($file));

View File

@@ -91,6 +91,10 @@ class Fields
# Now prepopulate the field object with the value */
if($field->getType() == "textarea")
{
if($fieldName == "publicformdefinitions" && $userValue == '')
{
$userValue = $objectSettings['settings'][$fieldName];
}
if($userValue)
{
$field->setContent($userValue);

View File

@@ -257,11 +257,16 @@ abstract class Plugin implements EventSubscriberInterface
# get settings and start validation
$originalSettings = \Typemill\Settings::getObjectSettings('plugins', $pluginName);
if(isset($settings['plugins'][$pluginName]['publicformdefinitions']))
if(isset($settings['plugins'][$pluginName]['publicformdefinitions']) && $settings['plugins'][$pluginName]['publicformdefinitions'] != '')
{
$arrayFromYaml = \Symfony\Component\Yaml\Yaml::parse($settings['plugins'][$pluginName]['publicformdefinitions']);
$originalSettings['public']['fields'] = $arrayFromYaml;
}
elseif(isset($originalSettings['settings']['publicformdefinitions']))
{
$arrayFromYaml = \Symfony\Component\Yaml\Yaml::parse($originalSettings['settings']['publicformdefinitions']);
$originalSettings['public']['fields'] = $arrayFromYaml;
}
$validate = new Validation();

View File

@@ -54,7 +54,7 @@
{% elseif field.type == 'checkbox' %}
<label class="control-group">{{ __( field.getCheckboxLabel() ) }}
<label class="control-group">{{ markdown( field.getCheckboxLabel() ) }}
<input type="checkbox" id="{{ itemName}}[{{ field.name }}]" name="{{ itemName}}[{{ field.name }}]"{{ field.getAttributeValues() }}{{ field.getAttributes() }}>
<span class="checkmark"></span>
</label>
@@ -65,7 +65,7 @@
{% for value,label in options %}
<label class="control-group">{{ __( label ) }}
<label class="control-group">{{ markdown( label ) }}
<input type="checkbox" id="{{ itemName }}[{{ field.name }}][{{value}}]" name="{{ itemName }}[{{ field.name }}][{{value}}]" {{ settings[object][itemName][field.name][value] ? ' checked' : '' }}>
<span class="checkmark"></span>
</label>
@@ -88,7 +88,7 @@
{% for value,label in options %}
<label class="control-group">{{ __(label) }}
<label class="control-group">{{ markdown(label) }}
<input type="radio" id="{{ itemName }}[{{ field.name }}]" name="{{ itemName }}[{{ field.name }}]" value="{{ value }}" {{ (value == settings[object][itemName][field.name]) ? ' checked' : '' }}>
<span class="radiomark"></span>
</label>