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)
|
public function upload(SS_HTTPRequest $request)
|
||||||
{
|
{
|
||||||
$recordClass = $this->gridField->list->dataClass;
|
$recordClass = $this->gridField->list->dataClass;
|
||||||
$recordForeignKey = $this->gridField->list->foreignKey;
|
|
||||||
$recordForeignID = $this->gridField->list->foreignID;
|
|
||||||
|
|
||||||
$record = Object::create($recordClass);
|
$record = Object::create($recordClass);
|
||||||
$record->setField($recordForeignKey, $recordForeignID);
|
|
||||||
// passes the current gridfield-instance to a call-back method on the new object
|
// passes the current gridfield-instance to a call-back method on the new object
|
||||||
$record->extend("onBulkImageUpload", $this->gridField);
|
$record->extend("onBulkImageUpload", $this->gridField);
|
||||||
|
|
||||||
$record->write();
|
$record->write();
|
||||||
|
$this->gridField->list->add($record->ID);
|
||||||
|
|
||||||
$upload = new Upload();
|
$upload = new Upload();
|
||||||
$tmpfile = $request->postVar('BulkImageUploadField');
|
$tmpfile = $request->postVar('BulkImageUploadField');
|
||||||
|
@ -187,20 +187,9 @@ class GridFieldBulkManager_Request extends RequestHandler {
|
|||||||
public function unlink(SS_HTTPRequest $request)
|
public function unlink(SS_HTTPRequest $request)
|
||||||
{
|
{
|
||||||
$recordList = $this->getPOSTRecordList($request);
|
$recordList = $this->getPOSTRecordList($request);
|
||||||
$recordClass = $this->gridField->list->dataClass;
|
$this->gridField->list->removeMany($recordList);
|
||||||
$recordForeignKey = $this->gridField->list->foreignKey;
|
|
||||||
//$recordForeignID = $this->gridField->list->foreignID;
|
|
||||||
$result = array();
|
|
||||||
|
|
||||||
foreach ( $recordList as $id )
|
$response = new SS_HTTPResponse(Convert::raw2json(array($recordList)));
|
||||||
{
|
|
||||||
$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->addHeader('Content-Type', 'text/plain');
|
$response->addHeader('Content-Type', 'text/plain');
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user