mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
MINOR: show download file link in the cms for file downloads. MINOR: code formating improvements.
This commit is contained in:
parent
eb359e80ec
commit
d3a3122b84
@ -335,14 +335,15 @@ class UserDefinedForm_Controller extends Page_Controller {
|
||||
$fields = new FieldSet();
|
||||
$required = array();
|
||||
|
||||
if( !$this->SubmitButtonText )
|
||||
if(!$this->SubmitButtonText) {
|
||||
$this->SubmitButtonText = 'Submit';
|
||||
|
||||
}
|
||||
foreach($this->Fields() as $field) {
|
||||
$fields->push($field->getFormField());
|
||||
if( $field->Required )
|
||||
if($field->Required) {
|
||||
$required[] = $field->Name;
|
||||
}
|
||||
}
|
||||
|
||||
if(!isset($_SERVER['HTTP_REFERER'])) {
|
||||
$_SERVER['HTTP_REFERER'] = "";
|
||||
|
@ -27,11 +27,10 @@ class EditableFileField extends EditableFormField {
|
||||
static $plural_names = 'File fields';
|
||||
|
||||
function getFormField() {
|
||||
if($field = parent::getFormField())
|
||||
if($field = parent::getFormField()) {
|
||||
return $field;
|
||||
}
|
||||
return new FileField($this->Name, $this->Title, $this->getField('Default'));
|
||||
// TODO We can't use the preview feature because FileIFrameField also shows the "From the file store" functionality
|
||||
//return new FileIFrameField( $this->Name, $this->Title, $this->getField('Default') );
|
||||
}
|
||||
|
||||
function getSimpleFormField(){
|
||||
|
@ -9,5 +9,23 @@ class SubmittedFileField extends SubmittedFormField {
|
||||
"UploadedFile" => "File"
|
||||
);
|
||||
|
||||
/**
|
||||
* Return the Value of this Field
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
function getValue() {
|
||||
return ($this->UploadedFile()) ? $this->UploadedFile()->Title : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Link object for this field
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
function getLink() {
|
||||
return ($this->UploadedFile()) ? $this->UploadedFile()->URL : "";
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@ -14,7 +14,7 @@
|
||||
<% control FieldValues %>
|
||||
<tr>
|
||||
<td class="field">$Title</td>
|
||||
<td class="value">$Value</td>
|
||||
<td class="value"><% if Link %><a href="$Link"><% end_if %>$Value<% if Link %></a><% end_if %></td>
|
||||
</tr>
|
||||
<% end_control %>
|
||||
</table>
|
||||
|
Loading…
Reference in New Issue
Block a user