mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
parent
7546bd08c0
commit
bc8f2bda59
@ -274,15 +274,13 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
|
||||
public function upload(SS_HTTPRequest $request)
|
||||
{
|
||||
$recordClass = $this->gridField->list->dataClass;
|
||||
$recordForeignKey = $this->gridField->list->foreignKey;
|
||||
$recordForeignID = $this->gridField->list->foreignID;
|
||||
|
||||
$record = Object::create($recordClass);
|
||||
$record->setField($recordForeignKey, $recordForeignID);
|
||||
|
||||
// passes the current gridfield-instance to a call-back method on the new object
|
||||
$record->extend("onBulkImageUpload", $this->gridField);
|
||||
|
||||
$record->write();
|
||||
$this->gridField->list->add($record->ID);
|
||||
|
||||
$upload = new Upload();
|
||||
$tmpfile = $request->postVar('BulkImageUploadField');
|
||||
|
@ -187,20 +187,9 @@ class GridFieldBulkManager_Request extends RequestHandler {
|
||||
public function unlink(SS_HTTPRequest $request)
|
||||
{
|
||||
$recordList = $this->getPOSTRecordList($request);
|
||||
$recordClass = $this->gridField->list->dataClass;
|
||||
$recordForeignKey = $this->gridField->list->foreignKey;
|
||||
//$recordForeignID = $this->gridField->list->foreignID;
|
||||
$result = array();
|
||||
$this->gridField->list->removeMany($recordList);
|
||||
|
||||
foreach ( $recordList as $id )
|
||||
{
|
||||
$record = DataObject::get_by_id($recordClass, $id);
|
||||
$res = $record->setField($recordForeignKey, 0);
|
||||
$record->write();
|
||||
array_push($result, array($id => $res));
|
||||
}
|
||||
|
||||
$response = new SS_HTTPResponse(Convert::raw2json(array($result)));
|
||||
$response = new SS_HTTPResponse(Convert::raw2json(array($recordList)));
|
||||
$response->addHeader('Content-Type', 'text/plain');
|
||||
return $response;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user