mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
Merge branch '3.0' into 3.1
This commit is contained in:
commit
77dbf8a317
@ -3,6 +3,7 @@
|
|||||||
namespace Symbiote\GridFieldExtensions;
|
namespace Symbiote\GridFieldExtensions;
|
||||||
|
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
|
use SilverStripe\Core\Injector\Injector;
|
||||||
use SilverStripe\Forms\Form;
|
use SilverStripe\Forms\Form;
|
||||||
use SilverStripe\Forms\GridField\GridField;
|
use SilverStripe\Forms\GridField\GridField;
|
||||||
use SilverStripe\Forms\GridField\GridField_HTMLProvider;
|
use SilverStripe\Forms\GridField\GridField_HTMLProvider;
|
||||||
@ -13,7 +14,6 @@ use SilverStripe\ORM\DataObjectInterface;
|
|||||||
use SilverStripe\ORM\FieldType\DBField;
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
use SilverStripe\ORM\ManyManyList;
|
use SilverStripe\ORM\ManyManyList;
|
||||||
use SilverStripe\View\ArrayData;
|
use SilverStripe\View\ArrayData;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
|
||||||
use SilverStripe\View\Requirements;
|
use SilverStripe\View\Requirements;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL
|
|||||||
|
|
||||||
GridFieldExtensions::include_requirements();
|
GridFieldExtensions::include_requirements();
|
||||||
|
|
||||||
$field = new DropdownField(sprintf('%s[ClassName]', self::POST_KEY), '', $classes, $this->defaultClass);
|
$field = new DropdownField(sprintf('%s[%s]', __CLASS__, $grid->getName()), '', $classes, $this->defaultClass);
|
||||||
if (Config::inst()->get(__CLASS__, 'showEmptyString')) {
|
if (Config::inst()->get(__CLASS__, 'showEmptyString')) {
|
||||||
$field->setEmptyString(_t('GridFieldExtensions.SELECTTYPETOCREATE', '(Select type to create)'));
|
$field->setEmptyString(_t('GridFieldExtensions.SELECTTYPETOCREATE', '(Select type to create)'));
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ use SilverStripe\Forms\ReadonlyField;
|
|||||||
use SilverStripe\ORM\DataList;
|
use SilverStripe\ORM\DataList;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\DataObjectInterface;
|
use SilverStripe\ORM\DataObjectInterface;
|
||||||
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
use SilverStripe\ORM\ManyManyList;
|
use SilverStripe\ORM\ManyManyList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,6 +21,7 @@ use SilverStripe\ORM\DB;
|
|||||||
use SilverStripe\ORM\ManyManyList;
|
use SilverStripe\ORM\ManyManyList;
|
||||||
use SilverStripe\ORM\Map;
|
use SilverStripe\ORM\Map;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
|
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||||
use SilverStripe\Versioned\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\View\ViewableData;
|
use SilverStripe\View\ViewableData;
|
||||||
|
|
||||||
@ -542,6 +543,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
|||||||
// match to order the objects.
|
// match to order the objects.
|
||||||
if (!$isVersioned) {
|
if (!$isVersioned) {
|
||||||
$sortTable = $this->getSortTable($list);
|
$sortTable = $this->getSortTable($list);
|
||||||
|
$now = DBDatetime::now()->Rfc2822();
|
||||||
$additionalSQL = '';
|
$additionalSQL = '';
|
||||||
$baseTable = $sortTable;
|
$baseTable = $sortTable;
|
||||||
if (class_exists($sortTable)) {
|
if (class_exists($sortTable)) {
|
||||||
@ -549,7 +551,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
|||||||
}
|
}
|
||||||
$isBaseTable = ($baseTable == $sortTable);
|
$isBaseTable = ($baseTable == $sortTable);
|
||||||
if (!$list instanceof ManyManyList && $isBaseTable) {
|
if (!$list instanceof ManyManyList && $isBaseTable) {
|
||||||
$additionalSQL = ', "LastEdited" = NOW()';
|
$additionalSQL = ", \"LastEdited\" = '$now'";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($sortedIDs as $sortValue => $id) {
|
foreach ($sortedIDs as $sortValue => $id) {
|
||||||
@ -565,8 +567,9 @@ class GridFieldOrderableRows extends RequestHandler implements
|
|||||||
|
|
||||||
if (!$isBaseTable) {
|
if (!$isBaseTable) {
|
||||||
DB::query(sprintf(
|
DB::query(sprintf(
|
||||||
'UPDATE "%s" SET "LastEdited" = NOW() WHERE %s',
|
'UPDATE "%s" SET "LastEdited" = \'%s\' WHERE %s',
|
||||||
$baseTable,
|
$baseTable,
|
||||||
|
$now,
|
||||||
$this->getSortTableClauseForIds($list, $id)
|
$this->getSortTableClauseForIds($list, $id)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -595,7 +598,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
|||||||
$field = $this->getSortField();
|
$field = $this->getSortField();
|
||||||
$table = $this->getSortTable($list);
|
$table = $this->getSortTable($list);
|
||||||
$clause = sprintf('"%s"."%s" = 0', $table, $this->getSortField());
|
$clause = sprintf('"%s"."%s" = 0', $table, $this->getSortField());
|
||||||
|
$now = DBDatetime::now()->Rfc2822();
|
||||||
$additionalSQL = '';
|
$additionalSQL = '';
|
||||||
$baseTable = $table;
|
$baseTable = $table;
|
||||||
if (class_exists($table)) {
|
if (class_exists($table)) {
|
||||||
@ -603,7 +606,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
|||||||
}
|
}
|
||||||
$isBaseTable = ($baseTable == $table);
|
$isBaseTable = ($baseTable == $table);
|
||||||
if (!$list instanceof ManyManyList && $isBaseTable) {
|
if (!$list instanceof ManyManyList && $isBaseTable) {
|
||||||
$additionalSQL = ', "LastEdited" = NOW()';
|
$additionalSQL = ", \"LastEdited\" = '$now'";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($list->where($clause)->column('ID') as $id) {
|
foreach ($list->where($clause)->column('ID') as $id) {
|
||||||
@ -621,8 +624,9 @@ class GridFieldOrderableRows extends RequestHandler implements
|
|||||||
|
|
||||||
if (!$isBaseTable) {
|
if (!$isBaseTable) {
|
||||||
DB::query(sprintf(
|
DB::query(sprintf(
|
||||||
'UPDATE "%s" SET "LastEdited" = NOW() WHERE %s',
|
'UPDATE "%s" SET "LastEdited" = \'%s\' WHERE %s',
|
||||||
$baseTable,
|
$baseTable,
|
||||||
|
$now,
|
||||||
$this->getSortTableClauseForIds($list, $id)
|
$this->getSortTableClauseForIds($list, $id)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ class GridFieldConfigurablePaginatorTest extends SapphireTest
|
|||||||
public function testGetPageSizesAsList()
|
public function testGetPageSizesAsList()
|
||||||
{
|
{
|
||||||
$paginator = new GridFieldConfigurablePaginator(10, array(10, 20, 30));
|
$paginator = new GridFieldConfigurablePaginator(10, array(10, 20, 30));
|
||||||
$this->assertDOSEquals(array(
|
$this->assertListEquals(array(
|
||||||
array('Size' => '10', 'Selected' => true),
|
array('Size' => '10', 'Selected' => true),
|
||||||
array('Size' => '20', 'Selected' => false),
|
array('Size' => '20', 'Selected' => false),
|
||||||
array('Size' => '30', 'Selected' => false),
|
array('Size' => '30', 'Selected' => false),
|
||||||
|
Loading…
Reference in New Issue
Block a user