Merge pull request #78 from halkyon/uploadfile_allowed_extensions

ENHANCEMENT Indicate which file extensions are allowed to be uploaded
This commit is contained in:
Ingo Schommer 2012-03-27 02:30:51 -07:00
commit 1c2ccaecb1

View File

@ -72,10 +72,24 @@ class CMSFileAddController extends LeftAndMain {
$uploadField->setFolderName(ASSETS_DIR);
}
$exts = $uploadField->getValidator()->getAllowedExtensions();
asort($exts);
$form = new Form(
$this,
'getEditForm',
new FieldList($uploadField, new HiddenField('ID')),
$this,
'getEditForm',
new FieldList(
$uploadField,
new LiteralField(
'AllowedExtensions',
sprintf(
'<p>%s: %s</p>',
_t('AssetAdmin.ALLOWEDEXTS', 'Allowed extensions'),
implode('<em>, </em>', $exts)
)
),
new HiddenField('ID')
),
new FieldList()
);
$form->addExtraClass('center cms-edit-form ' . $this->BaseCSSClasses());
@ -121,4 +135,4 @@ class CMSFileAddController extends LeftAndMain {
return $items;
}
}
}