mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
ENHANCEMENT: Select the uploaded image after uploading by default. #4962 (from r97765)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@102747 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c0707cb562
commit
2a5cb1eb87
@ -200,6 +200,7 @@ JS
|
|||||||
$status = "";
|
$status = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$fileObj = false;
|
||||||
foreach($newFiles as $newFile) {
|
foreach($newFiles as $newFile) {
|
||||||
$fileIDs[] = $newFile;
|
$fileIDs[] = $newFile;
|
||||||
$fileObj = DataObject::get_one('File', "\"File\".\"ID\"=$newFile");
|
$fileObj = DataObject::get_one('File', "\"File\".\"ID\"=$newFile");
|
||||||
@ -208,7 +209,27 @@ JS
|
|||||||
$fileNames[] = $fileObj->Name;
|
$fileNames[] = $fileObj->Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Replace with clientside logic which doesn't have assumptions in the response
|
// 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);
|
||||||
|
|
||||||
echo <<<HTML
|
echo <<<HTML
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var url = parent.document.getElementById('sitetree').getTreeNodeByIdx( "{$folder->ID}" ).getElementsByTagName('a')[0].href;
|
var url = parent.document.getElementById('sitetree').getTreeNodeByIdx( "{$folder->ID}" ).getElementsByTagName('a')[0].href;
|
||||||
|
Loading…
Reference in New Issue
Block a user