mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
cleaning up the code
This commit is contained in:
parent
cf0a3262f7
commit
fe8e41aa40
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
//define global path to Components' root folder
|
||||||
if(!defined('BULK_EDIT_TOOLS_PATH'))
|
if(!defined('BULK_EDIT_TOOLS_PATH'))
|
||||||
{
|
{
|
||||||
define('BULK_EDIT_TOOLS_PATH', rtrim(basename(dirname(__FILE__))));
|
define('BULK_EDIT_TOOLS_PATH', rtrim(basename(dirname(__FILE__))));
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
*
|
* Base Component for all 'GridFieldBulkEditingTools'
|
||||||
|
* defines the common HTML fragment
|
||||||
*
|
*
|
||||||
* @author colymba
|
* @author colymba
|
||||||
* @package GridFieldBulkEditingTools
|
* @package GridFieldBulkEditingTools
|
||||||
@ -12,7 +13,6 @@ class GridFieldBulkEditingTools implements GridField_HTMLProvider
|
|||||||
Requirements::css(BULK_EDIT_TOOLS_PATH . '/css/GridFieldBulkEditingTools.css');
|
Requirements::css(BULK_EDIT_TOOLS_PATH . '/css/GridFieldBulkEditingTools.css');
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
//"footer" => '<tr><td colspan="'.$columnsCount.'">\$DefineFragment(bulk-edit-tools)</td></tr>'
|
|
||||||
"after" => "<div id=\"bulkEditTools\">\$DefineFragment(bulk-edit-tools)</div>"
|
"after" => "<div id=\"bulkEditTools\">\$DefineFragment(bulk-edit-tools)</div>"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,7 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static $url_handlers = array(
|
static $url_handlers = array(
|
||||||
'$Action!' => '$Action'/*,
|
'$Action!' => '$Action'
|
||||||
'' => 'uploadForm'*/
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,53 +120,10 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a list of the GridField managed DataObject's editable fields: (HTML)Text, (HTML)Varchar and Enum fields
|
*
|
||||||
*
|
* @param type $recordID
|
||||||
* @return array
|
* @return type
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
function getDefaultRecordEditableFields()
|
|
||||||
{
|
|
||||||
$recordClass = $this->gridField->list->dataClass;
|
|
||||||
$recordDbFields = Config::inst()->get($recordClass, 'db', Config::UNINHERITED);
|
|
||||||
|
|
||||||
$editableFields = array();
|
|
||||||
foreach ( $recordDbFields as $field => $type )
|
|
||||||
{
|
|
||||||
if ( preg_match( '/(Text|Varchar|Enum)/i', $type ) > 0 ) {
|
|
||||||
array_push($editableFields, $field);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $editableFields;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the CMS edit field for a given name. As set in the GridField managed DataObject getCMSFields method
|
|
||||||
*
|
|
||||||
* @param string $fieldName
|
|
||||||
* @return FormField
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
function getFieldEditForm($fieldName)
|
|
||||||
{
|
|
||||||
if ( !$this->recordCMSFieldList ) {
|
|
||||||
$recordClass = $this->gridField->list->dataClass;
|
|
||||||
$this->recordCMSFieldList = singleton($recordClass)->getCMSFields();
|
|
||||||
}
|
|
||||||
|
|
||||||
$field = $this->recordCMSFieldList->fieldByName($fieldName);
|
|
||||||
|
|
||||||
if ( !$field ) {
|
|
||||||
$fields = $this->recordCMSFieldList->dataFields();
|
|
||||||
$field = $fields[$fieldName];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $field;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
function getRecordHTMLFormFields( $recordID = 0 )
|
function getRecordHTMLFormFields( $recordID = 0 )
|
||||||
{
|
{
|
||||||
$config = $this->component->getConfig();
|
$config = $this->component->getConfig();
|
||||||
@ -336,19 +292,6 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
|
|||||||
//get record's CMS Fields
|
//get record's CMS Fields
|
||||||
$recordEditableFormFields = $this->getRecordHTMLFormFields( $record->ID );
|
$recordEditableFormFields = $this->getRecordHTMLFormFields( $record->ID );
|
||||||
|
|
||||||
|
|
||||||
// collect all editable fields forms
|
|
||||||
/*
|
|
||||||
$recordEditableFieldsForms = array();
|
|
||||||
foreach ( $this->getRecordEditableFields() as $editableFieldName )
|
|
||||||
{
|
|
||||||
$formField = $this->getFieldEditForm($editableFieldName);
|
|
||||||
if ( $formField ) {
|
|
||||||
array_push($recordEditableFieldsForms, $this->parseFieldHTMLWithRecordID($formField->FieldHolder(), $record->ID) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Collect all output data.
|
// Collect all output data.
|
||||||
$return = array_merge($return, array(
|
$return = array_merge($return, array(
|
||||||
'id' => $file->ID,
|
'id' => $file->ID,
|
||||||
|
Loading…
Reference in New Issue
Block a user