mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
BUGFIX: A Submitted file couldn't not be shown / downloaded in the submission report
This commit is contained in:
parent
0bbfb720ca
commit
1590172d0c
@ -19,11 +19,12 @@ class SubmittedFileField extends SubmittedFormField {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getFormattedValue() {
|
public function getFormattedValue() {
|
||||||
|
$name = $this->getName();
|
||||||
$link = $this->getLink();
|
$link = $this->getLink();
|
||||||
$title = _t('SubmittedFileField.DOWNLOADFILE', 'Download File');
|
$title = _t('SubmittedFileField.DOWNLOADFILE', 'Download File');
|
||||||
|
|
||||||
if($link) {
|
if($link) {
|
||||||
return sprintf('<a href="%s">%s</a>', $link, $title);
|
return sprintf('%s - <a href="%s" target="_blank">%s</a>', $name, $link, $title);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -49,5 +50,16 @@ class SubmittedFileField extends SubmittedFormField {
|
|||||||
return $this->UploadedFile()->URL;
|
return $this->UploadedFile()->URL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of the file, if present
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName() {
|
||||||
|
if($this->UploadedFile()) {
|
||||||
|
return $this->UploadedFile()->Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -13,7 +13,7 @@
|
|||||||
<div id="Text_readonly" class="field readonly text">
|
<div id="Text_readonly" class="field readonly text">
|
||||||
<label class="left" for="Form_EditForm_Text_readonly">$Title</label>
|
<label class="left" for="Form_EditForm_Text_readonly">$Title</label>
|
||||||
<div class="middleColumn">
|
<div class="middleColumn">
|
||||||
<span id="Form_EditForm_Text_readonly" class="readonly text">$Value</span>
|
<span id="Form_EditForm_Text_readonly" class="readonly text">$FormattedValue</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user