diff --git a/code/UserDefinedForm.php b/code/UserDefinedForm.php
index 5bae03f..3522a1d 100755
--- a/code/UserDefinedForm.php
+++ b/code/UserDefinedForm.php
@@ -505,7 +505,7 @@ JS
// don't show fields that shouldn't be shown
if(!$field->showInReports()) continue;
- $submittedField = new SubmittedFormField();
+ $submittedField = $field->getSubmittedFormField();
$submittedField->ParentID = $submittedForm->ID;
$submittedField->Name = $field->Name;
$submittedField->Title = $field->Title;
@@ -518,11 +518,7 @@ JS
}
if(!empty($data[$field->Name])){
- /**
- * @todo this should be on the EditableFile class. Just need to sort out
- * attachments array
- */
- if($field->ClassName == "EditableFileField"){
+ if(in_array("EditableFileField", $field->getClassAncestry())) {
if(isset($_FILES[$field->Name])) {
// create the file from post data
@@ -537,13 +533,6 @@ JS
if($file->getAbsoluteSize() < 1024*1024*1){
$attachments[] = $file;
}
-
- // Always provide the link if present.
- if($file->ID) {
- $submittedField->Value = "getFilename() ."\" title=\"". $file->getFilename() . "\">". $file->Title . "";
- } else {
- $submittedField->Value = "";
- }
}
}
}
diff --git a/code/editor/EditableFileField.php b/code/editor/EditableFileField.php
index 8693bac..88e4521 100755
--- a/code/editor/EditableFileField.php
+++ b/code/editor/EditableFileField.php
@@ -7,11 +7,6 @@
class EditableFileField extends EditableFormField {
- // this needs to be moved.
- static $has_one = array(
- "UploadedFile" => "File"
- );
-
/**
* @see Upload->allowedMaxFileSize
* @var int
@@ -32,11 +27,7 @@ class EditableFileField extends EditableFormField {
return new FileField($this->Name, $this->Title);
}
- /**
- * Workaround to handle uploads on the UserFormPage
- */
- public function getValueFromData($data) {
- return "";
- }
-
+ public function getSubmittedFormField() {
+ return new SubmittedFileField();
+ }
}
\ No newline at end of file
diff --git a/code/editor/EditableFormField.php b/code/editor/EditableFormField.php
index 9409c9d..8a30645 100755
--- a/code/editor/EditableFormField.php
+++ b/code/editor/EditableFormField.php
@@ -333,6 +333,15 @@ class EditableFormField extends DataObject {
user_error("Please implement a getFormField() on your EditableFormClass ". $this->ClassName, E_USER_ERROR);
}
+ /**
+ * Return the instance of the submission field class
+ *
+ * @return SubmittedFormField
+ */
+ public function getSubmittedFormField() {
+ return new SubmittedFormField();
+ }
+
function showInReports() {
return true;
}
diff --git a/code/submissions/SubmittedFileField.php b/code/submissions/SubmittedFileField.php
index 1e1f8c0..bff8684 100755
--- a/code/submissions/SubmittedFileField.php
+++ b/code/submissions/SubmittedFileField.php
@@ -17,7 +17,7 @@ class SubmittedFileField extends SubmittedFormField {
* @return String
*/
function getValue() {
- return ($this->UploadedFile()) ? $this->UploadedFile()->Title : "";
+ return ''. _t('SubmittedFileField.DOWNLOADFILE', 'Download File') .'';
}
/**