mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02: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) {
|
||||
$processedFiles = array();
|
||||
$newFiles = array();
|
||||
$fileIDs = array();
|
||||
$fileNames = array();
|
||||
$fileSizeWarnings = '';
|
||||
$uploadErrors = '';
|
||||
$jsErrors = '';
|
||||
$status = '';
|
||||
$statusMessage = '';
|
||||
|
||||
if(!isset($data['Files'])) return Director::set_status_code("404");
|
||||
|
||||
@ -174,26 +182,17 @@ JS
|
||||
$processedFiles[$key][$param] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$proccessedFiles[] = $data['Files'];
|
||||
}
|
||||
|
||||
// get the folder to upload to.
|
||||
if(isset($data['FolderID']) && $data['FolderID'] != "root") {
|
||||
$folder = DataObject::get_by_id('Folder', $data['FolderID']);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$folder = DataObject::get_one('Folder');
|
||||
}
|
||||
|
||||
$newFiles = array();
|
||||
$fileSizeWarnings = '';
|
||||
$uploadErrors = '';
|
||||
$jsErrors = '';
|
||||
$status = '';
|
||||
$statusMessage = '';
|
||||
|
||||
foreach($processedFiles as $tmpFile) {
|
||||
if($tmpFile['error'] == UPLOAD_ERR_NO_TMP_DIR) {
|
||||
$status = 'bad';
|
||||
@ -232,15 +231,13 @@ JS
|
||||
|
||||
if($newFiles) {
|
||||
$numFiles = sizeof($newFiles);
|
||||
$statusMessage = sprintf(_t('AssetAdmin.UPLOADEDX',"Uploaded %s files"),$numFiles) ;
|
||||
$statusMessage = sprintf(_t('AssetAdmin.UPLOADEDX',"Uploaded %s files"),$numFiles);
|
||||
$status = "good";
|
||||
} else if($status != 'bad') {
|
||||
$statusMessage = _t('AssetAdmin.NOTHINGTOUPLOAD','There was nothing to upload');
|
||||
$status = "";
|
||||
}
|
||||
|
||||
$fileIDs = array();
|
||||
$fileNames = array();
|
||||
foreach($newFiles as $newFile) {
|
||||
$fileIDs[] = $newFile;
|
||||
$fileObj = DataObject::get_one('File', "\"File\".\"ID\"=$newFile");
|
||||
|
Loading…
Reference in New Issue
Block a user