BUGFIX: A Submitted file couldn't not be shown / downloaded in the submission report

This commit is contained in:
Stig Lindqvist 2012-05-14 14:16:46 +12:00
parent 0bbfb720ca
commit 1590172d0c
2 changed files with 15 additions and 3 deletions

View File

@ -19,11 +19,12 @@ class SubmittedFileField extends SubmittedFormField {
* @return string
*/
public function getFormattedValue() {
$name = $this->getName();
$link = $this->getLink();
$title = _t('SubmittedFileField.DOWNLOADFILE', 'Download File');
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;
@ -49,5 +50,16 @@ class SubmittedFileField extends SubmittedFormField {
return $this->UploadedFile()->URL;
}
}
}
}
/**
* Return the name of the file, if present
*
* @return string
*/
public function getName() {
if($this->UploadedFile()) {
return $this->UploadedFile()->Name;
}
}
}

View File

@ -13,7 +13,7 @@
<div id="Text_readonly" class="field readonly text">
<label class="left" for="Form_EditForm_Text_readonly">$Title</label>
<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>