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,16 +9,20 @@
|
||||
class GridFieldBulkActionDeleteHandler extends GridFieldBulkActionHandler
|
||||
{
|
||||
/**
|
||||
* List of action handling methods
|
||||
* RequestHandler allowed actions
|
||||
* @var array
|
||||
*/
|
||||
private static $allowed_actions = array('delete');
|
||||
|
||||
|
||||
/**
|
||||
* URL handling rules.
|
||||
* RequestHandler url => action map
|
||||
* @var array
|
||||
*/
|
||||
private static $url_handlers = array(
|
||||
'delete' => 'delete'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Delete the selected records passed from the delete bulk action
|
||||
|
@ -9,13 +9,15 @@
|
||||
class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
|
||||
{
|
||||
/**
|
||||
* List of action handling methods
|
||||
* RequestHandler allowed actions
|
||||
* @var array
|
||||
*/
|
||||
private static $allowed_actions = array('edit', 'update');
|
||||
|
||||
|
||||
/**
|
||||
* URL handling rules.
|
||||
* RequestHandler url => action map
|
||||
* @var array
|
||||
*/
|
||||
private static $url_handlers = array(
|
||||
'bulkedit/update' => 'update',
|
||||
|
@ -9,17 +9,21 @@
|
||||
class GridFieldBulkActionUnlinkHandler extends GridFieldBulkActionHandler
|
||||
{
|
||||
/**
|
||||
* List of action handling methods
|
||||
* RequestHandler allowed actions
|
||||
* @var array
|
||||
*/
|
||||
private static $allowed_actions = array('unlink');
|
||||
|
||||
|
||||
/**
|
||||
* URL handling rules.
|
||||
* RequestHandler url => action map
|
||||
* @var array
|
||||
*/
|
||||
private static $url_handlers = array(
|
||||
'unlink' => 'unlink'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Unlink the selected records passed from the unlink bulk action
|
||||
*
|
||||
|
@ -11,7 +11,6 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
/**
|
||||
* component configuration
|
||||
*
|
||||
* 'imageFieldName' => field name of the $has_one Model Image relation
|
||||
* 'editableFields' => fields editable on the Model
|
||||
* 'readOnlyFieldClasses' => field types that will be converted to readonly
|
||||
* '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');
|
||||
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
if ( $editableFields != null ) $this->setConfig ( 'editableFields', $editableFields );
|
||||
@ -112,6 +117,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns one $config parameter of the full $config
|
||||
@ -125,6 +131,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
else return $this->config;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a field to the editable fields blacklist
|
||||
*
|
||||
@ -135,6 +142,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
{
|
||||
return array_push( $this->config['fieldsNameBlacklist'], $fieldName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a class to the readonly list
|
||||
@ -146,6 +154,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
{
|
||||
return array_push( $this->config['readOnlyFieldClasses'], $className);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove a field to the editable fields blacklist
|
||||
@ -161,6 +170,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove a class to the readonly list
|
||||
@ -269,6 +279,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
{
|
||||
if(!in_array('BulkSelect', $columns)) $columns[] = 'BulkSelect';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Which columns are handled by the component
|
||||
@ -280,6 +291,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
{
|
||||
return array('BulkSelect');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the column's content
|
||||
@ -296,6 +308,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
->setAttribute('data-record', $record->ID);
|
||||
return $cb->Field();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the column's HTML attributes
|
||||
@ -310,6 +323,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
return array('class' => 'col-bulkSelect');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the column's meta data
|
||||
*
|
||||
@ -401,6 +415,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
'bulkaction' => 'handlebulkaction'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pass control over to the RequestHandler
|
||||
@ -436,4 +451,4 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
|
||||
|
||||
user_error("Unable to find matching bulk action handler for ".$request->remaining().'.', E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
@ -24,7 +24,9 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
||||
'sequentialUploads' => false
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Component constructor
|
||||
*
|
||||
* @param string $fileRelationName
|
||||
* @param string/array $editableFields
|
||||
@ -68,6 +70,7 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
||||
$this->config[$reference] = $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 the ClassName of the fileRelation
|
||||
* i.e. 'MyImage' => 'Image' will return 'Image'
|
||||
@ -279,6 +283,7 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pass control over to the RequestHandler
|
||||
*
|
||||
@ -293,5 +298,4 @@ class GridFieldBulkUpload implements GridField_HTMLProvider, GridField_URLHandle
|
||||
|
||||
return $handler->handleRequest($request, DataModel::inst());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,11 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Handles request from the GridFieldBulkUpload component
|
||||
*
|
||||
* Handles:
|
||||
* * Form creation
|
||||
* * file upload
|
||||
* * editing and cancelling records
|
||||
* Handles request from the GridFieldBulkUpload component
|
||||
*
|
||||
* @author colymba
|
||||
* @package GridFieldBulkEditingTools
|
||||
@ -14,46 +9,47 @@
|
||||
class GridFieldBulkUpload_Request extends RequestHandler
|
||||
{
|
||||
/**
|
||||
*
|
||||
* Gridfield instance
|
||||
* @var GridField
|
||||
*/
|
||||
protected $gridField;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @var GridField_URLHandler
|
||||
* Bulk upload component
|
||||
* @var GridFieldBulkUpload
|
||||
*/
|
||||
protected $component;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Gridfield Form controller
|
||||
* @var Controller
|
||||
*/
|
||||
protected $controller;
|
||||
|
||||
|
||||
/**
|
||||
* Cache the records FieldList from getCMSfields()
|
||||
*
|
||||
* @var FieldList
|
||||
*/
|
||||
protected $recordCMSFieldList;
|
||||
|
||||
/**
|
||||
*
|
||||
* RequestHandler allowed actions
|
||||
* @var array
|
||||
*/
|
||||
private static $allowed_actions = array(
|
||||
'upload', 'select', 'attach', 'fileexists'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* RequestHandler url => action map
|
||||
* @var array
|
||||
*/
|
||||
private static $url_handlers = array(
|
||||
'$Action!' => '$Action'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Handler's constructor
|
||||
*
|
||||
* @param GridFIeld $gridField
|
||||
* @param GridField_URLHandler $component
|
||||
* @param Controller $controller
|
||||
|
@ -1,10 +1,5 @@
|
||||
(function($) {
|
||||
$.entwine('ss', function($) {
|
||||
|
||||
// start SS namespace overrides
|
||||
|
||||
|
||||
// end SS namespace overrides
|
||||
|
||||
|
||||
$.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...
|
||||
*/
|
||||
@ -282,4 +266,4 @@
|
||||
}); // colymba namespace
|
||||
|
||||
}); // ss namespace
|
||||
}(jQuery));
|
||||
}(jQuery));
|
@ -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>' +
|
||||
'{% } else { %}' +
|
||||
//'<div class="ss-uploadfield-item-actions">{% print(file.buttons, true); %}</div>' +
|
||||
'{% } %}' +
|
||||
'</div>' +
|
||||
'</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