Merge pull request #2558 from chillu/pulls/uploadfield-874

HTML attr encoding for UploadField config
This commit is contained in:
Ingo Schommer 2013-10-23 13:00:39 -07:00
commit 739d591e45
3 changed files with 5 additions and 5 deletions

View File

@ -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());

View File

@ -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,
{

View File

@ -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 %>