mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
Clean up
This commit is contained in:
parent
5437424b7e
commit
38d05df2ec
@ -9,17 +9,21 @@
|
|||||||
class GridFieldBulkActionDeleteHandler extends GridFieldBulkActionHandler
|
class GridFieldBulkActionDeleteHandler extends GridFieldBulkActionHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* List of action handling methods
|
* RequestHandler allowed actions
|
||||||
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $allowed_actions = array('delete');
|
private static $allowed_actions = array('delete');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL handling rules.
|
* RequestHandler url => action map
|
||||||
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $url_handlers = array(
|
private static $url_handlers = array(
|
||||||
'delete' => 'delete'
|
'delete' => 'delete'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the selected records passed from the delete bulk action
|
* Delete the selected records passed from the delete bulk action
|
||||||
*
|
*
|
||||||
|
@ -9,13 +9,15 @@
|
|||||||
class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
|
class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* List of action handling methods
|
* RequestHandler allowed actions
|
||||||
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $allowed_actions = array('edit', 'update');
|
private static $allowed_actions = array('edit', 'update');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL handling rules.
|
* RequestHandler url => action map
|
||||||
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $url_handlers = array(
|
private static $url_handlers = array(
|
||||||
'bulkedit/update' => 'update',
|
'bulkedit/update' => 'update',
|
||||||
|
@ -9,17 +9,21 @@
|
|||||||
class GridFieldBulkActionUnlinkHandler extends GridFieldBulkActionHandler
|
class GridFieldBulkActionUnlinkHandler extends GridFieldBulkActionHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* List of action handling methods
|
* RequestHandler allowed actions
|
||||||
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $allowed_actions = array('unlink');
|
private static $allowed_actions = array('unlink');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL handling rules.
|
* RequestHandler url => action map
|
||||||
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $url_handlers = array(
|
private static $url_handlers = array(
|
||||||
'unlink' => 'unlink'
|
'unlink' => 'unlink'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlink the selected records passed from the unlink bulk action
|
* Unlink the selected records passed from the unlink bulk action
|
||||||
*
|
*
|
||||||
|
@ -11,7 +11,6 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
|||||||
/**
|
/**
|
||||||
* component configuration
|
* component configuration
|
||||||
*
|
*
|
||||||
* 'imageFieldName' => field name of the $has_one Model Image relation
|
|
||||||
* 'editableFields' => fields editable on the Model
|
* 'editableFields' => fields editable on the Model
|
||||||
* 'readOnlyFieldClasses' => field types that will be converted to readonly
|
* 'readOnlyFieldClasses' => field types that will be converted to readonly
|
||||||
* 'fieldsNameBlacklist' => fields that will be removed from the automatic form generation
|
* 'fieldsNameBlacklist' => fields that will be removed from the automatic form generation
|
||||||
@ -34,6 +33,12 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
|||||||
protected $readOnlyFieldClasses = array('GridField', 'UploadField');
|
protected $readOnlyFieldClasses = array('GridField', 'UploadField');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GridFieldBulkManager component constructor
|
||||||
|
*
|
||||||
|
* @param array $editableFields List of editable fields
|
||||||
|
* @param boolean $defaultActions Use default actions list. False to start fresh.
|
||||||
|
*/
|
||||||
public function __construct($editableFields = null, $defaultActions = true)
|
public function __construct($editableFields = null, $defaultActions = true)
|
||||||
{
|
{
|
||||||
if ( $editableFields != null ) $this->setConfig ( 'editableFields', $editableFields );
|
if ( $editableFields != null ) $this->setConfig ( 'editableFields', $editableFields );
|
||||||
@ -113,6 +118,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns one $config parameter of the full $config
|
* Returns one $config parameter of the full $config
|
||||||
*
|
*
|
||||||
@ -125,6 +131,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
|||||||
else return $this->config;
|
else return $this->config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a field to the editable fields blacklist
|
* Add a field to the editable fields blacklist
|
||||||
*
|
*
|
||||||
@ -136,6 +143,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
|||||||
return array_push( $this->config['fieldsNameBlacklist'], $fieldName);
|
return array_push( $this->config['fieldsNameBlacklist'], $fieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a class to the readonly list
|
* Add a class to the readonly list
|
||||||
*
|
*
|
||||||
@ -147,6 +155,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
|||||||
return array_push( $this->config['readOnlyFieldClasses'], $className);
|
return array_push( $this->config['readOnlyFieldClasses'], $className);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a field to the editable fields blacklist
|
* Remove a field to the editable fields blacklist
|
||||||
*
|
*
|
||||||
@ -162,6 +171,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a class to the readonly list
|
* Remove a class to the readonly list
|
||||||
*
|
*
|
||||||
@ -270,6 +280,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
|||||||
if(!in_array('BulkSelect', $columns)) $columns[] = 'BulkSelect';
|
if(!in_array('BulkSelect', $columns)) $columns[] = 'BulkSelect';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Which columns are handled by the component
|
* Which columns are handled by the component
|
||||||
*
|
*
|
||||||
@ -281,6 +292,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
|||||||
return array('BulkSelect');
|
return array('BulkSelect');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the column's content
|
* Sets the column's content
|
||||||
*
|
*
|
||||||
@ -297,6 +309,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
|||||||
return $cb->Field();
|
return $cb->Field();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the column's HTML attributes
|
* Set the column's HTML attributes
|
||||||
*
|
*
|
||||||
@ -310,6 +323,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
|||||||
return array('class' => 'col-bulkSelect');
|
return array('class' => 'col-bulkSelect');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the column's meta data
|
* Set the column's meta data
|
||||||
*
|
*
|
||||||
@ -402,6 +416,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pass control over to the RequestHandler
|
* Pass control over to the RequestHandler
|
||||||
* loop through the handlers provided in config['actions']
|
* loop through the handlers provided in config['actions']
|
||||||
|
@ -24,7 +24,9 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
|||||||
'sequentialUploads' => false
|
'sequentialUploads' => false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Component constructor
|
||||||
*
|
*
|
||||||
* @param string $fileRelationName
|
* @param string $fileRelationName
|
||||||
* @param string/array $editableFields
|
* @param string/array $editableFields
|
||||||
@ -68,6 +70,7 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
|||||||
$this->config[$reference] = $value;
|
$this->config[$reference] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns one $config parameter of the full $config
|
* Returns one $config parameter of the full $config
|
||||||
*
|
*
|
||||||
@ -118,6 +121,7 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
|||||||
return $configFileRelationName ? $configFileRelationName : $this->getDefaultFileRelationName($gridField);
|
return $configFileRelationName ? $configFileRelationName : $this->getDefaultFileRelationName($gridField);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the ClassName of the fileRelation
|
* Return the ClassName of the fileRelation
|
||||||
* i.e. 'MyImage' => 'Image' will return 'Image'
|
* i.e. 'MyImage' => 'Image' will return 'Image'
|
||||||
@ -279,6 +283,7 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pass control over to the RequestHandler
|
* Pass control over to the RequestHandler
|
||||||
*
|
*
|
||||||
@ -294,4 +299,3 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
|||||||
return $handler->handleRequest($request, DataModel::inst());
|
return $handler->handleRequest($request, DataModel::inst());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,11 +2,6 @@
|
|||||||
/**
|
/**
|
||||||
* Handles request from the GridFieldBulkUpload component
|
* Handles request from the GridFieldBulkUpload component
|
||||||
*
|
*
|
||||||
* Handles:
|
|
||||||
* * Form creation
|
|
||||||
* * file upload
|
|
||||||
* * editing and cancelling records
|
|
||||||
*
|
|
||||||
* @author colymba
|
* @author colymba
|
||||||
* @package GridFieldBulkEditingTools
|
* @package GridFieldBulkEditingTools
|
||||||
* @subpackage BulkUpload
|
* @subpackage BulkUpload
|
||||||
@ -14,45 +9,46 @@
|
|||||||
class GridFieldBulkUpload_Request extends RequestHandler
|
class GridFieldBulkUpload_Request extends RequestHandler
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
* Gridfield instance
|
||||||
* @var GridField
|
* @var GridField
|
||||||
*/
|
*/
|
||||||
protected $gridField;
|
protected $gridField;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Bulk upload component
|
||||||
* @var GridField_URLHandler
|
* @var GridFieldBulkUpload
|
||||||
*/
|
*/
|
||||||
protected $component;
|
protected $component;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Gridfield Form controller
|
||||||
* @var Controller
|
* @var Controller
|
||||||
*/
|
*/
|
||||||
protected $controller;
|
protected $controller;
|
||||||
|
|
||||||
/**
|
|
||||||
* Cache the records FieldList from getCMSfields()
|
|
||||||
*
|
|
||||||
* @var FieldList
|
|
||||||
*/
|
|
||||||
protected $recordCMSFieldList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* RequestHandler allowed actions
|
||||||
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $allowed_actions = array(
|
private static $allowed_actions = array(
|
||||||
'upload', 'select', 'attach', 'fileexists'
|
'upload', 'select', 'attach', 'fileexists'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* RequestHandler url => action map
|
||||||
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $url_handlers = array(
|
private static $url_handlers = array(
|
||||||
'$Action!' => '$Action'
|
'$Action!' => '$Action'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Handler's constructor
|
||||||
*
|
*
|
||||||
* @param GridFIeld $gridField
|
* @param GridFIeld $gridField
|
||||||
* @param GridField_URLHandler $component
|
* @param GridField_URLHandler $component
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
(function($) {
|
(function($) {
|
||||||
$.entwine('ss', function($) {
|
$.entwine('ss', function($) {
|
||||||
|
|
||||||
// start SS namespace overrides
|
|
||||||
|
|
||||||
|
|
||||||
// end SS namespace overrides
|
|
||||||
|
|
||||||
|
|
||||||
$.entwine('colymba', function($) {
|
$.entwine('colymba', function($) {
|
||||||
|
|
||||||
@ -74,17 +69,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Track completed uploads
|
|
||||||
*//*
|
|
||||||
$('li.ss-uploadfield-item.done').entwine({
|
|
||||||
onmatch: function(){
|
|
||||||
this.parents('ul.ss-uploadfield-files').trackProgress();
|
|
||||||
},
|
|
||||||
onunmatch: function(){},
|
|
||||||
});*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update buttons state and progress info...
|
* Update buttons state and progress info...
|
||||||
*/
|
*/
|
||||||
|
@ -23,10 +23,8 @@ window.tmpl.cache['colymba-bulkuploaddownloadtemplate'] = tmpl(
|
|||||||
'<div class="ss-uploadfield-item-cancel ss-uploadfield-item-cancelfailed delete"><button class="icon icon-16" data-icon="delete" title="' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '">' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '</button></div>' +
|
'<div class="ss-uploadfield-item-cancel ss-uploadfield-item-cancelfailed delete"><button class="icon icon-16" data-icon="delete" title="' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '">' + ss.i18n._t('UploadField.CANCELREMOVE', 'Cancel/Remove') + '</button></div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'{% } else { %}' +
|
'{% } else { %}' +
|
||||||
//'<div class="ss-uploadfield-item-actions">{% print(file.buttons, true); %}</div>' +
|
|
||||||
'{% } %}' +
|
'{% } %}' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</li>' +
|
'</li>' +
|
||||||
'{% } %}'
|
'{% } %}'
|
||||||
);
|
);
|
||||||
//'<div class="ss-uploadfield-item-editform loading"><iframe frameborder="0" src="{%=file.edit_url%}"></iframe></div>' +
|
|
||||||
|
Loading…
Reference in New Issue
Block a user