2012-08-10 00:52:46 +03:00
GridField Bulk Editing Tools
============================
2012-09-06 19:05:16 +03:00
SilverStripe 3 GridField component set to facilitate bulk image upload, bulk record editing, unlinking and deleting.
Included are:
* [Bulk Image Upload ](#bulk-image-upload ): Bulk images upload and on the fly fields editing
* [Bulk Manager ](#bulk-manager ): Delete and unlink multiple records at once as well as editing records in bulk
2013-04-16 20:06:24 +03:00
## Requirements
2013-05-07 20:07:45 +03:00
* SilverStripe 3.1 (version master / 1.+)
2013-04-16 20:06:24 +03:00
* Silverstripe 3.0 (version [0.5 ](https://github.com/colymba/GridFieldBulkEditingTools/tree/0.5 ))
2012-07-18 02:27:28 +03:00
2013-06-16 17:20:19 +03:00
## Development notes
The master branch will try to be compatible with the latest SilverStripe release/pre-release. Please submit pull request against the master branch. Older branches are kept for compatibility but may not be maintained.
2013-04-16 20:36:15 +03:00
## Preview
![preview ](screenshots/preview.png )
[More screenshots here. ](screenshots )
2012-07-18 02:27:28 +03:00
## Installation
2012-08-10 00:52:46 +03:00
* Download and copy module in SilverStripe root directory and name it whatever you want
2012-07-18 02:27:28 +03:00
* Run dev/build?flush=all to regenerate the manifest
* run ?flush=all in CMS to force the templates to regenerate
2012-09-06 19:05:16 +03:00
## Bulk Image Upload
2012-08-10 00:52:46 +03:00
A component for uploading images in bulk into the managed Model relation, with option to edit fields on the fly.
2012-07-19 15:00:11 +03:00
### Usage 1
2012-09-05 23:40:59 +03:00
Simplest usage, add the component to your GridField as below. The component will find the first Image has_one relation on the managed Model and the record's editable CMS fields
2012-08-10 00:52:46 +03:00
2012-07-18 02:27:28 +03:00
$config->addComponent(new GridFieldBulkImageUpload());
2012-07-19 15:00:11 +03:00
### Usage 2
You can specify which Image field to use and which fields are editable from the managed Model
2013-06-26 19:46:46 +03:00
$fileRelationName (string): The name of the File/Image field to use (If your relation is set has 'MyImage' => 'Image', the parameter should be 'MyImage')
2012-07-19 15:00:11 +03:00
$editableFields (array): list of db fields name as string that will be editable like: array('myTextField', 'myVarcharField', 'myEnumField')
2012-08-10 00:52:46 +03:00
2013-06-26 19:46:46 +03:00
$config->addComponent(new GridFieldBulkImageUpload( $fileRelationName, $editableFields ));
2012-07-18 02:27:28 +03:00
2012-08-10 00:52:46 +03:00
### Configuration
2012-09-05 23:40:59 +03:00
The component's option can be configurated individually or in bulk through the 'config' functions like this:
$config->getComponentByType('GridFieldBulkImageUpload')->setConfig( $reference, $value );
2012-08-10 00:52:46 +03:00
#### $config overview
The available configuration options are:
2013-06-26 19:46:46 +03:00
* 'fileRelationName' : sets the name of the File/Image field of the managed Model (i.e. 'MyImage')
2012-08-10 00:52:46 +03:00
* 'editableFields' : array of string referencing specific CMS fields available for editing
* '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
2013-01-10 19:23:36 +02:00
* 'sequentialUploads' : boolean, if true files will be uploaded one by one
2013-03-26 10:48:12 +02:00
* 'maxFileSize' : integer, maximum upload file size in bytes
2012-08-10 00:52:46 +03:00
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:
* addFieldNameToBlacklist( $fieldName )
* addClassToBlacklist( $className )
* removeFieldNameFromBlacklist( $fieldName )
* removeClassFromBlacklist( $className )
2012-09-06 19:05:16 +03:00
## Bulk Manager
2012-09-05 23:40:59 +03:00
A component for Editing, deleting and unlinking records on the fly
2012-09-06 19:05:16 +03:00
### Usage
2012-09-05 23:40:59 +03:00
Add GridFieldBulkEditingTools component if not done already and simply add GridFieldBulkImageUpload
$config->addComponent(new GridFieldBulkManager());
2012-09-06 19:05:16 +03:00
### Configuration
2012-09-05 23:40:59 +03:00
The component's option can be configurated individually or in bulk through the 'config' functions like this:
$config->getComponentByType('GridFieldBulkManager')->setConfig( $reference, $value );
2012-09-06 19:05:16 +03:00
#### $config overview
2012-09-05 23:40:59 +03:00
The available configuration options are:
* 'editableFields' : array of string referencing specific CMS fields available for editing
* '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
2012-09-06 19:05:16 +03:00
## Notes
2013-06-16 17:20:19 +03:00
* The Record edit form uses the Model's getCMSFields()
2012-07-18 02:27:28 +03:00
2013-06-16 17:20:19 +03:00
### @TODO
2012-08-10 00:52:46 +03:00
2013-06-16 17:20:19 +03:00
### Known bug
2012-09-05 23:40:59 +03:00
* When editing fields, if the last field of the edit form is a drop down or similar, the drop down menu is cropped off
2012-08-10 00:52:46 +03:00
2012-09-06 19:05:16 +03:00
### Bulk Image Upload
2012-07-19 15:00:11 +03:00
* Add individual actions for each upload (update + cancel)
2012-07-18 15:23:51 +03:00
* Handle and display errors better for: creation, update, cancel
2013-06-16 17:20:19 +03:00
* Make it work not only for images but Files too