mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #2558 from chillu/pulls/uploadfield-874
HTML attr encoding for UploadField config
This commit is contained in:
commit
739d591e45
@ -1000,7 +1000,7 @@ class UploadField extends FileField {
|
||||
|
||||
$mergedConfig = array_merge($config, $this->ufConfig);
|
||||
return $this->customise(array(
|
||||
'configString' => str_replace('"', "'", Convert::raw2json($mergedConfig)),
|
||||
'configString' => str_replace('"', """, Convert::raw2json($mergedConfig)),
|
||||
'config' => new ArrayData($mergedConfig),
|
||||
'multiple' => $allowedMaxFileNumber !== 1
|
||||
))->renderWith($this->getTemplates());
|
||||
|
@ -151,9 +151,9 @@
|
||||
|
||||
if(this.is('.readonly,.disabled')) return;
|
||||
|
||||
var fileInput = this.find('input[type=file]');
|
||||
var fileInput = this.find('.ss-uploadfield-fromcomputer-fileinput');
|
||||
var dropZone = this.find('.ss-uploadfield-dropzone');
|
||||
var config = $.parseJSON(fileInput.data('config').replace(/'/g,'"'));
|
||||
var config = fileInput.data('config');
|
||||
|
||||
/* Attach classes to dropzone when element can be dropped*/
|
||||
$(document).unbind('dragover');
|
||||
@ -181,8 +181,6 @@
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.setConfig(config);
|
||||
this.fileupload($.extend(true,
|
||||
{
|
||||
|
@ -52,6 +52,8 @@
|
||||
<% _t('UploadField.FROMCOMPUTER', 'From your computer') %>
|
||||
<input id="$id" name="{$Name}[Uploads][]" class="$extraClass ss-uploadfield-fromcomputer-fileinput" data-config="$configString" type="file"<% if $multiple %> multiple="multiple"<% end_if %> />
|
||||
</label>
|
||||
<% else %>
|
||||
<input id="$id" name="{$Name}[Uploads][]" class="$extraClass ss-uploadfield-fromcomputer-fileinput" data-config="$configString" type="hidden" />
|
||||
<% end_if %>
|
||||
|
||||
<% if $canAttachExisting %>
|
||||
|
Loading…
Reference in New Issue
Block a user