FIX #8 Add config option for sequential uploads

setting Component option 'sequentialUploads' to true will upload files
one by one in the order they were selected
This commit is contained in:
colymba 2013-01-10 19:23:36 +02:00
parent efe4e35c9c
commit eb944b6aa8
3 changed files with 11 additions and 2 deletions

View File

@ -44,6 +44,7 @@ The available configuration options are:
* 'fieldsClassBlacklist' : array of string referencing types (ClassName) of fields that wont be available for editing
* 'fieldsNameBlacklist' : array of string referencing the names of fields that wont be available for editing
* 'folderName' : name of the folder where the images should be uploaded
* 'sequentialUploads' : boolean, if true files will be uploaded one by one
Each option can be set through the component's method setConfig( $reference, $value )
In addition, some configuration option can be set more specifically via individual methods:

View File

@ -22,7 +22,8 @@ class GridFieldBulkImageUpload implements GridField_HTMLProvider, GridField_URLH
'editableFields' => null,
'fieldsClassBlacklist' => array(),
'fieldsNameBlacklist' => array(),
'folderName' => 'bulkUpload'
'folderName' => 'bulkUpload',
'sequentialUploads' => false
);
/**
@ -68,6 +69,12 @@ class GridFieldBulkImageUpload implements GridField_HTMLProvider, GridField_URLH
$value = array_unique( array_merge($value, $this->forbiddenFieldsClasses) );
}
//sequentialUploads true/false
if ( $reference == 'sequentialUploads' && !is_bool($value) )
{
$value = false;
}
$this->config[$reference] = $value;
}

View File

@ -200,6 +200,7 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
$uploadField->setTemplate('AssetUploadField');
$uploadField->setConfig('downloadTemplateName','GridFieldBulkImageUpload_downloadtemplate');
$uploadField->setConfig('sequentialUploads', $this->component->getConfig('sequentialUploads'));
$uploadField->setConfig('url', $this->Link('upload'));