mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
MINOR Moved defined variables in AssetAdmin::doUpload() to the top of the method for consistency
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@96230 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
08e9a35242
commit
2e762da45e
@ -164,6 +164,14 @@ JS
|
|||||||
*/
|
*/
|
||||||
function doUpload($data, $form) {
|
function doUpload($data, $form) {
|
||||||
$processedFiles = array();
|
$processedFiles = array();
|
||||||
|
$newFiles = array();
|
||||||
|
$fileIDs = array();
|
||||||
|
$fileNames = array();
|
||||||
|
$fileSizeWarnings = '';
|
||||||
|
$uploadErrors = '';
|
||||||
|
$jsErrors = '';
|
||||||
|
$status = '';
|
||||||
|
$statusMessage = '';
|
||||||
|
|
||||||
if(!isset($data['Files'])) return Director::set_status_code("404");
|
if(!isset($data['Files'])) return Director::set_status_code("404");
|
||||||
|
|
||||||
@ -174,26 +182,17 @@ JS
|
|||||||
$processedFiles[$key][$param] = $value;
|
$processedFiles[$key][$param] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$proccessedFiles[] = $data['Files'];
|
$proccessedFiles[] = $data['Files'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the folder to upload to.
|
// get the folder to upload to.
|
||||||
if(isset($data['FolderID']) && $data['FolderID'] != "root") {
|
if(isset($data['FolderID']) && $data['FolderID'] != "root") {
|
||||||
$folder = DataObject::get_by_id('Folder', $data['FolderID']);
|
$folder = DataObject::get_by_id('Folder', $data['FolderID']);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$folder = DataObject::get_one('Folder');
|
$folder = DataObject::get_one('Folder');
|
||||||
}
|
}
|
||||||
|
|
||||||
$newFiles = array();
|
|
||||||
$fileSizeWarnings = '';
|
|
||||||
$uploadErrors = '';
|
|
||||||
$jsErrors = '';
|
|
||||||
$status = '';
|
|
||||||
$statusMessage = '';
|
|
||||||
|
|
||||||
foreach($processedFiles as $tmpFile) {
|
foreach($processedFiles as $tmpFile) {
|
||||||
if($tmpFile['error'] == UPLOAD_ERR_NO_TMP_DIR) {
|
if($tmpFile['error'] == UPLOAD_ERR_NO_TMP_DIR) {
|
||||||
$status = 'bad';
|
$status = 'bad';
|
||||||
@ -232,15 +231,13 @@ JS
|
|||||||
|
|
||||||
if($newFiles) {
|
if($newFiles) {
|
||||||
$numFiles = sizeof($newFiles);
|
$numFiles = sizeof($newFiles);
|
||||||
$statusMessage = sprintf(_t('AssetAdmin.UPLOADEDX',"Uploaded %s files"),$numFiles) ;
|
$statusMessage = sprintf(_t('AssetAdmin.UPLOADEDX',"Uploaded %s files"),$numFiles);
|
||||||
$status = "good";
|
$status = "good";
|
||||||
} else if($status != 'bad') {
|
} else if($status != 'bad') {
|
||||||
$statusMessage = _t('AssetAdmin.NOTHINGTOUPLOAD','There was nothing to upload');
|
$statusMessage = _t('AssetAdmin.NOTHINGTOUPLOAD','There was nothing to upload');
|
||||||
$status = "";
|
$status = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileIDs = array();
|
|
||||||
$fileNames = array();
|
|
||||||
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");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user