mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
ENHANCEMENT: Select the uploaded image after uploading by default. #4962
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@97765 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c8c8811f64
commit
39772cfcc4
@ -219,6 +219,7 @@ JS
|
||||
$status = "";
|
||||
}
|
||||
|
||||
$fileObj = false;
|
||||
foreach($newFiles as $newFile) {
|
||||
$fileIDs[] = $newFile;
|
||||
$fileObj = DataObject::get_one('File', "\"File\".\"ID\"=$newFile");
|
||||
@ -227,6 +228,24 @@ JS
|
||||
$fileNames[] = $fileObj->Name;
|
||||
}
|
||||
|
||||
// workaround for content editors image upload.Passing an extra hidden field
|
||||
// in the content editors view of 'UploadMode' @see HtmlEditorField
|
||||
// this will be refactored for 2.5
|
||||
if(isset($data['UploadMode']) && $data['UploadMode'] == "CMSEditor" && $fileObj) {
|
||||
// we can use $fileObj considering that the uploader in the cmseditor can only upload
|
||||
// one file at a time. Once refactored to multiple files this is going to have to be changed
|
||||
$width = (is_a($fileObj, 'Image')) ? $fileObj->getWidth() : '100';
|
||||
$height = (is_a($fileObj, 'Image')) ? $fileObj->getHeight() : '100';
|
||||
|
||||
$values = array(
|
||||
'Filename' => $fileObj->Filename,
|
||||
'Width' => $width,
|
||||
'Height' => $height
|
||||
);
|
||||
|
||||
return Convert::raw2json($values);
|
||||
}
|
||||
|
||||
$sFileIDs = implode(',', $fileIDs);
|
||||
$sFileNames = implode(',', $fileNames);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user