Changed namespacing so the fix is usable as long as the fix is not merged

This commit is contained in:
Svenvdzwet 2022-12-28 11:29:24 +01:00 committed by PixNyb
parent d57ea0bd46
commit d333fad49c
No known key found for this signature in database
GPG Key ID: 3D8A3F6458B449FB
20 changed files with 118 additions and 118 deletions

View File

@ -1,10 +1,10 @@
mappings:
GridFieldBulkActionDeleteHandler: Colymba\BulkManager\BulkAction\DeleteHandler
GridFieldBulkActionEditHandler: Colymba\BulkManager\BulkAction\EditHandler
GridFieldBulkActionHandler: Colymba\BulkManager\BulkAction\Handler
GridFieldBulkActionUnlinkHandler: Colymba\BulkManager\BulkAction\UnlinkHandler
GridFieldBulkManager: Colymba\BulkManager\BulkManager
BulkUploadField: Colymba\BulkUpload\BulkUploadField
GridFieldBulkImageUpload: Colymba\BulkUpload\GridFieldBulkImageUpload
GridFieldBulkUpload: Colymba\BulkUpload\BulkUploader
GridFieldBulkUpload_Request: Colymba\BulkUpload\BulkUploadHandler
GridFieldBulkActionDeleteHandler: Violet88\BulkManager\BulkAction\DeleteHandler
GridFieldBulkActionEditHandler: Violet88\BulkManager\BulkAction\EditHandler
GridFieldBulkActionHandler: Violet88\BulkManager\BulkAction\Handler
GridFieldBulkActionUnlinkHandler: Violet88\BulkManager\BulkAction\UnlinkHandler
GridFieldBulkManager: Violet88\BulkManager\BulkManager
BulkUploadField: Violet88\BulkUpload\BulkUploadField
GridFieldBulkImageUpload: Violet88\BulkUpload\GridFieldBulkImageUpload
GridFieldBulkUpload: Violet88\BulkUpload\BulkUploader
GridFieldBulkUpload_Request: Violet88\BulkUpload\BulkUploadHandler

View File

@ -1,3 +1,3 @@
SilverStripe\Admin\LeftAndMain:
extra_requirements_javascript:
- 'colymba/gridfield-bulk-editing-tools: client/dist/js/main.js'
- 'violet88/gridfield-bulk-editing-tools: client/dist/js/main.js'

View File

@ -2,7 +2,7 @@
import jQuery from 'jquery';
import i18n from 'i18n';
jQuery.entwine('colymba', ($) => {
jQuery.entwine('violet88', ($) => {
/**
* Makes sure the component is above the headers
*/

View File

@ -1,7 +1,7 @@
/* global window */
import jQuery from 'jquery';
jQuery.entwine('colymba', ($) => {
jQuery.entwine('violet88', ($) => {
/**
* Toggle all accordion forms
* open or closed

View File

@ -1,5 +1,5 @@
{
"name": "colymba/gridfield-bulk-editing-tools",
"name": "violet88/gridfield-bulk-editing-tools",
"type": "silverstripe-vendormodule",
"description": "SilverStripe GridField component to upload images/files and edit records in bulk",
"homepage": "https://github.com/colymba/GridFieldBulkEditingTools",
@ -30,9 +30,9 @@
},
"autoload": {
"psr-4": {
"Colymba\\BulkTools\\": "src/BulkTools/",
"Colymba\\BulkManager\\": "src/BulkManager/",
"Colymba\\BulkUpload\\": "src/BulkUploader/"
"Violet88\\BulkTools\\": "src/BulkTools/",
"Violet88\\BulkManager\\": "src/BulkManager/",
"Violet88\\BulkUpload\\": "src/BulkUploader/"
}
}
}

View File

@ -12,7 +12,7 @@ $config->addComponent(new \Colymba\BulkManager\BulkManager());
The component's options can be configurated individually or in bulk through the 'config' functions like this:
```php
$config->getComponentByType('Colymba\\BulkManager\\BulkManager')->setConfig($reference, $value);
$config->getComponentByType('Violet88\\BulkManager\\BulkManager')->setConfig($reference, $value);
```
### $config overview
@ -27,14 +27,14 @@ To add a custom bulk action to the list use:
```php
$config
->getComponentByType('Colymba\\BulkManager\\BulkManager')
->getComponentByType('Violet88\\BulkManager\\BulkManager')
->addBulkAction('Namespace\\ClassName')
```
#### Custom action handler
When creating your own bulk action `RequestHandler`, you should extend `Colymba\BulkManager\BulkAction\Handler` which will expose 2 useful functions `getRecordIDList()` and `getRecords()` returning either an array with the selected records IDs or a `DataList` of the selected records.
When creating your own bulk action `RequestHandler`, you should extend `Violet88\BulkManager\BulkAction\Handler` which will expose 2 useful functions `getRecordIDList()` and `getRecords()` returning either an array with the selected records IDs or a `DataList` of the selected records.
Make sure to define the handler's `$url_segment`, from which the handler will be called and its relating `$allowed_actions` and `$url_handlers`. See `Handler`, `DeleteHandler` and `UnlinkHandler` for examples.
#### Front-end config
Bulk action handler's front-end configuration is set via class properties `label`, `icon`, `buttonClasses`, `xhr` and `destructive`. See `Handler`, `DeleteHandler` and `UnlinkHandler` for reference and examples.
Bulk action handler's front-end configuration is set via class properties `label`, `icon`, `buttonClasses`, `xhr` and `destructive`. See `Handler`, `DeleteHandler` and `UnlinkHandler` for reference and examples.

View File

@ -1,9 +1,9 @@
<?php
namespace Colymba\BulkManager\BulkAction;
namespace Violet88\BulkManager\BulkAction;
use Colymba\BulkManager\BulkAction\Handler;
use Colymba\BulkTools\HTTPBulkToolsResponse;
use Violet88\BulkManager\BulkAction\Handler;
use Violet88\BulkTools\HTTPBulkToolsResponse;
use SilverStripe\Core\Convert;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse;
@ -19,7 +19,7 @@ class ArchiveHandler extends Handler
/**
* URL segment used to call this handler
* If none given, @BulkManager will fallback to the Unqualified class name
*
*
* @var string
*/
private static $url_segment = 'archive';
@ -42,14 +42,14 @@ class ArchiveHandler extends Handler
/**
* Front-end label for this handler's action
*
*
* @var string
*/
protected $label = 'Archive';
/**
* Front-end icon path for this handler's action.
*
*
* @var string
*/
protected $icon = '';
@ -57,22 +57,22 @@ class ArchiveHandler extends Handler
/**
* Extra classes to add to the bulk action button for this handler
* Can also be used to set the button font-icon e.g. font-icon-trash
*
*
* @var string
*/
protected $buttonClasses = 'font-icon-trash';
/**
* Whether this handler should be called via an XHR from the front-end
*
*
* @var boolean
*/
protected $xhr = true;
/**
* Set to true is this handler will destroy any data.
* A warning and confirmation will be shown on the front-end.
*
*
* @var boolean
*/
protected $destructive = true;

View File

@ -1,9 +1,9 @@
<?php
namespace Colymba\BulkManager\BulkAction;
namespace Violet88\BulkManager\BulkAction;
use Colymba\BulkManager\BulkAction\Handler;
use Colymba\BulkTools\HTTPBulkToolsResponse;
use Violet88\BulkManager\BulkAction\Handler;
use Violet88\BulkTools\HTTPBulkToolsResponse;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse;
use SilverStripe\Core\Convert;
@ -19,7 +19,7 @@ class DeleteHandler extends Handler
/**
* URL segment used to call this handler
* If none given, @BulkManager will fallback to the Unqualified class name
*
*
* @var string
*/
private static $url_segment = 'delete';
@ -42,14 +42,14 @@ class DeleteHandler extends Handler
/**
* Front-end label for this handler's action
*
*
* @var string
*/
protected $label = 'Delete';
/**
* Front-end icon path for this handler's action.
*
*
* @var string
*/
protected $icon = '';
@ -57,22 +57,22 @@ class DeleteHandler extends Handler
/**
* Extra classes to add to the bulk action button for this handler
* Can also be used to set the button font-icon e.g. font-icon-trash
*
*
* @var string
*/
protected $buttonClasses = 'font-icon-trash';
/**
* Whether this handler should be called via an XHR from the front-end
*
*
* @var boolean
*/
protected $xhr = true;
/**
* Set to true is this handler will destroy any data.
* A warning and confirmation will be shown on the front-end.
*
*
* @var boolean
*/
protected $destructive = true;

View File

@ -1,8 +1,8 @@
<?php
namespace Colymba\BulkManager\BulkAction;
namespace Violet88\BulkManager\BulkAction;
use Colymba\BulkManager\BulkAction\Handler;
use Violet88\BulkManager\BulkAction\Handler;
use SilverStripe\Control\Controller;
use SilverStripe\Core\Convert;
use SilverStripe\Control\HTTPResponse;
@ -25,7 +25,7 @@ class EditHandler extends Handler
/**
* URL segment used to call this handler
* If none given, @BulkManager will fallback to the Unqualified class name
*
*
* @var string
*/
private static $url_segment = 'edit';
@ -54,14 +54,14 @@ class EditHandler extends Handler
/**
* Front-end label for this handler's action
*
*
* @var string
*/
protected $label = 'Edit';
/**
* Front-end icon path for this handler's action.
*
*
* @var string
*/
protected $icon = '';
@ -69,22 +69,22 @@ class EditHandler extends Handler
/**
* Extra classes to add to the bulk action button for this handler
* Can also be used to set the button font-icon e.g. font-icon-trash
*
*
* @var string
*/
protected $buttonClasses = 'font-icon-edit';
/**
* Whether this handler should be called via an XHR from the front-end
*
*
* @var boolean
*/
protected $xhr = false;
/**
* Set to true is this handler will destroy any data.
* A warning and confirmation will be shown on the front-end.
*
*
* @var boolean
*/
protected $destructive = false;
@ -368,9 +368,9 @@ class EditHandler extends Handler
$form->addExtraClass('center cms-content');
$form->setAttribute('data-pjax-fragment', 'CurrentForm Content');
Requirements::javascript('colymba/gridfield-bulk-editing-tools:client/dist/js/main.js');
Requirements::css('colymba/gridfield-bulk-editing-tools:client/dist/styles/main.css');
Requirements::add_i18n_javascript('colymba/gridfield-bulk-editing-tools:lang');
Requirements::javascript('violet88/gridfield-bulk-editing-tools:client/dist/js/main.js');
Requirements::css('violet88/gridfield-bulk-editing-tools:client/dist/styles/main.css');
Requirements::add_i18n_javascript('violet88/gridfield-bulk-editing-tools:lang');
if ($this->request->isAjax()) {
$response = new HTTPResponse(

View File

@ -1,6 +1,6 @@
<?php
namespace Colymba\BulkManager\BulkAction;
namespace Violet88\BulkManager\BulkAction;
use SilverStripe\Control\Controller;
use SilverStripe\Control\RequestHandler;
@ -21,7 +21,7 @@ class Handler extends RequestHandler
/**
* URL segment used to call this handler
* If none given, @BulkManager will fallback to the Unqualified class name
*
*
* @var string
*/
private static $url_segment = null;
@ -42,14 +42,14 @@ class Handler extends RequestHandler
/**
* Front-end label for this handler's action
*
*
* @var string
*/
protected $label = 'Action';
/**
* Front-end icon path for this handler's action.
*
*
* @var string
*/
protected $icon = '';
@ -57,22 +57,22 @@ class Handler extends RequestHandler
/**
* Extra classes to add to the bulk action button for this handler
* Can also be used to set the button font-icon e.g. font-icon-trash
*
*
* @var string
*/
protected $buttonClasses = '';
/**
* Whether this handler should be called via an XHR from the front-end
*
*
* @var boolean
*/
protected $xhr = true;
/**
* Set to true is this handler will destroy any data.
* A warning and confirmation will be shown on the front-end.
*
*
* @var boolean
*/
protected $destructive = false;
@ -108,7 +108,7 @@ class Handler extends RequestHandler
/**
* Set if hanlder performs destructive actions
*
*
* @param boolean destructive If true, a warning will be shown on the front-end
* @return RequestHandler
*/
@ -117,10 +117,10 @@ class Handler extends RequestHandler
$this->destructive = $destructive;
return $this;
}
/**
* True if the hanlder performs destructive actions
*
*
* @return boolean
*/
public function getDestructive()
@ -130,11 +130,11 @@ class Handler extends RequestHandler
/**
* Set if handler is called via XHR
*
*
* @param boolean xhr If true the handler will be called via an XHR from front-end
* @return RequestHandler
*/
public function setXhr($xhr)
{
$this->xhr = $xhr;

View File

@ -1,9 +1,9 @@
<?php
namespace Colymba\BulkManager\BulkAction;
namespace Violet88\BulkManager\BulkAction;
use Colymba\BulkManager\BulkAction\Handler;
use Colymba\BulkTools\HTTPBulkToolsResponse;
use Violet88\BulkManager\BulkAction\Handler;
use Violet88\BulkTools\HTTPBulkToolsResponse;
use SilverStripe\Core\Convert;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse;
@ -19,7 +19,7 @@ class PublishHandler extends Handler
/**
* URL segment used to call this handler
* If none given, @BulkManager will fallback to the Unqualified class name
*
*
* @var string
*/
private static $url_segment = 'publish';
@ -42,14 +42,14 @@ class PublishHandler extends Handler
/**
* Front-end label for this handler's action
*
*
* @var string
*/
protected $label = 'Publish';
/**
* Front-end icon path for this handler's action.
*
*
* @var string
*/
protected $icon = '';
@ -57,22 +57,22 @@ class PublishHandler extends Handler
/**
* Extra classes to add to the bulk action button for this handler
* Can also be used to set the button font-icon e.g. font-icon-trash
*
*
* @var string
*/
protected $buttonClasses = 'font-icon-rocket';
/**
* Whether this handler should be called via an XHR from the front-end
*
*
* @var boolean
*/
protected $xhr = true;
/**
* Set to true is this handler will destroy any data.
* A warning and confirmation will be shown on the front-end.
*
*
* @var boolean
*/
protected $destructive = false;
@ -123,7 +123,7 @@ class PublishHandler extends Handler
$response->setStatusCode(500);
$response->setMessage($ex->getMessage());
}
return $response;
}
}

View File

@ -1,9 +1,9 @@
<?php
namespace Colymba\BulkManager\BulkAction;
namespace Violet88\BulkManager\BulkAction;
use Colymba\BulkManager\BulkAction\Handler;
use Colymba\BulkTools\HTTPBulkToolsResponse;
use Violet88\BulkManager\BulkAction\Handler;
use Violet88\BulkTools\HTTPBulkToolsResponse;
use SilverStripe\Core\Convert;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse;
@ -19,7 +19,7 @@ class UnPublishHandler extends Handler
/**
* URL segment used to call this handler
* If none given, @BulkManager will fallback to the Unqualified class name
*
*
* @var string
*/
private static $url_segment = 'unpublish';
@ -42,14 +42,14 @@ class UnPublishHandler extends Handler
/**
* Front-end label for this handler's action
*
*
* @var string
*/
protected $label = 'UnPublish';
/**
* Front-end icon path for this handler's action.
*
*
* @var string
*/
protected $icon = '';
@ -57,22 +57,22 @@ class UnPublishHandler extends Handler
/**
* Extra classes to add to the bulk action button for this handler
* Can also be used to set the button font-icon e.g. font-icon-trash
*
*
* @var string
*/
protected $buttonClasses = '';
/**
* Whether this handler should be called via an XHR from the front-end
*
*
* @var boolean
*/
protected $xhr = true;
/**
* Set to true is this handler will destroy any data.
* A warning and confirmation will be shown on the front-end.
*
*
* @var boolean
*/
protected $destructive = false;
@ -98,7 +98,7 @@ class UnPublishHandler extends Handler
{
$records = $this->getRecords();
$response = new HTTPBulkToolsResponse(false, $this->gridField);
try {
foreach ($records as $record)
{

View File

@ -1,9 +1,9 @@
<?php
namespace Colymba\BulkManager\BulkAction;
namespace Violet88\BulkManager\BulkAction;
use Colymba\BulkManager\BulkAction\Handler;
use Colymba\BulkTools\HTTPBulkToolsResponse;
use Violet88\BulkManager\BulkAction\Handler;
use Violet88\BulkTools\HTTPBulkToolsResponse;
use SilverStripe\Core\Convert;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse;
@ -19,7 +19,7 @@ class UnlinkHandler extends Handler
/**
* URL segment used to call this handler
* If none given, @BulkManager will fallback to the Unqualified class name
*
*
* @var string
*/
private static $url_segment = 'unlink';
@ -42,14 +42,14 @@ class UnlinkHandler extends Handler
/**
* Front-end label for this handler's action
*
*
* @var string
*/
protected $label = 'Unlink';
/**
* Front-end icon path for this handler's action.
*
*
* @var string
*/
protected $icon = '';
@ -57,22 +57,22 @@ class UnlinkHandler extends Handler
/**
* Extra classes to add to the bulk action button for this handler
* Can also be used to set the button font-icon e.g. font-icon-trash
*
*
* @var string
*/
protected $buttonClasses = 'font-icon-link-broken';
/**
* Whether this handler should be called via an XHR from the front-end
*
*
* @var boolean
*/
protected $xhr = true;
/**
* Set to true is this handler will destroy any data.
* A warning and confirmation will be shown on the front-end.
*
*
* @var boolean
*/
protected $destructive = false;

View File

@ -1,6 +1,6 @@
<?php
namespace Colymba\BulkManager;
namespace Violet88\BulkManager;
use ReflectionClass;
use SilverStripe\Control\HTTPRequest;
@ -290,7 +290,7 @@ class BulkManager implements GridField_HTMLProvider, GridField_ColumnProvider, G
->addExtraClass('bulkActionName no-change-track form-group--no-label')
->setAttribute('id', '')
->setEmptyString(_t('SilverStripe\Admin\LeftAndMain.DropdownBatchActionsDefault', 'Choose an action...'));
$templateData = array(
'Menu' => $dropDownActionsList->FieldHolder(),

View File

@ -1,6 +1,6 @@
<?php
namespace Colymba\BulkTools;
namespace Violet88\BulkTools;
use SilverStripe\Control\HTTPResponse;
use SilverStripe\Forms\GridField\GridField;

View File

@ -1,6 +1,6 @@
<?php
namespace Colymba\BulkUpload;
namespace Violet88\BulkUpload;
use SilverStripe\Control\Controller;
//use SilverStripe\Forms\UploadField;

View File

@ -1,8 +1,8 @@
<?php
namespace Colymba\BulkUpload;
namespace Violet88\BulkUpload;
use Colymba\BulkTools\HTTPBulkToolsResponse;
use Violet88\BulkTools\HTTPBulkToolsResponse;
use SilverStripe\Control\Controller;
use SilverStripe\Control\RequestHandler;
use SilverStripe\Control\HTTPRequest;
@ -70,7 +70,7 @@ class BulkUploadHandler extends RequestHandler
* Add file ID to the Dataobject
* Add DataObject to Gridfield list
* Publish DataObject if enabled
*
*
* @param integer $fileID The newly uploaded/attached file ID
*
* @return DataObject The new DataObject
@ -86,7 +86,7 @@ class BulkUploadHandler extends RequestHandler
$fileRelationName = $this->component->getFileRelationName($this->gridField);
$record->{"{$fileRelationName}ID"} = $fileID;
$record->write(); //HasManyList call write on record but not ManyManyList, so we call it here again
$this->gridField->list->add($record);
if (
@ -111,7 +111,7 @@ class BulkUploadHandler extends RequestHandler
{
$assetAdmin = AssetAdmin::singleton();
$uploadResponse = $assetAdmin->apiCreateFile($request);
if ($uploadResponse->getStatusCode() == 200)
{
$responseData = Convert::json2array($uploadResponse->getBody());
@ -121,7 +121,7 @@ class BulkUploadHandler extends RequestHandler
$bulkToolsResponse = new HTTPBulkToolsResponse(false, $this->gridField);
$bulkToolsResponse->addSuccessRecord($record);
$responseData['bulkTools'] = json_decode($bulkToolsResponse->getBody() ?? '');
$uploadResponse->setBody(json_encode(array($responseData)));
}

View File

@ -1,6 +1,6 @@
<?php
namespace Colymba\BulkUpload;
namespace Violet88\BulkUpload;
use SilverStripe\ORM\DataObject;
use SilverStripe\View\ArrayData;
@ -295,11 +295,11 @@ class BulkUploader implements GridField_HTMLProvider, GridField_URLHandler
));
//This one is no longer needed since the javascript is now loaded at the top of the cms
//Requirements::javascript('colymba/gridfield-bulk-editing-tools:client/dist/js/main.js');
Requirements::css('colymba/gridfield-bulk-editing-tools:client/dist/styles/main.css');
Requirements::add_i18n_javascript('colymba/gridfield-bulk-editing-tools:client/lang');
Requirements::css('violet88/gridfield-bulk-editing-tools:client/dist/styles/main.css');
Requirements::add_i18n_javascript('violet88/gridfield-bulk-editing-tools:client/lang');
return array(
'before' => $data->renderWith('Colymba\\BulkUpload\\BulkUploader'),
'before' => $data->renderWith('Violet88\\BulkUpload\\BulkUploader'),
);
}