Skip to content

Commit

Permalink
Implemented a fix for the admin section not updating the temporary tr…
Browse files Browse the repository at this point in the history
…ee view.
  • Loading branch information
Nathan Glasl committed Dec 4, 2013
1 parent 6148f9a commit 43d7045
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions code/controllers/ExternalContentAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,12 @@ public function addprovider() {
sprintf(_t('ExternalContent.SourceAdded', 'Successfully created %s'), $type)
);
Session::set("FormInfo.Form_EditForm.formError.type", 'good');

/*
$this->response->addHeader('X-Status', rawurlencode(_t('ExternalContent.PROVIDERADDED', "New $type created.")));
return $this->getResponseNegotiator()->respond($this->request);
*/
echo '<script>window.location.reload();</script>';
return;
}


Expand Down Expand Up @@ -558,10 +561,7 @@ public function generatePageIconsCss() {
}

/**
* Save the content source/item
*
* @param array $urlParams
* @param Form $form
* Save the content source/item.
*/
public function save($urlParams, $form) {

Expand Down Expand Up @@ -595,6 +595,31 @@ public function save($urlParams, $form) {
return $this->getResponseNegotiator()->respond($this->request);
}

/**
* Delete the content source/item.
*/
public function delete($data, $form) {
$className = $this->stat('tree_class');

$record = DataObject::get_by_id($className, Convert::raw2sql($data['ID']));
if($record && !$record->canDelete()) return Security::permissionFailure();
if(!$record || !$record->ID) $this->httpError(404, "Bad record ID #" . (int)$data['ID']);
$type = $record->ClassName;
$record->delete();

Session::set("FormInfo.Form_EditForm.formError.message", "Deleted $type");
Session::set("FormInfo.Form_EditForm.formError.type", 'bad');
/*
$this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.DELETED', 'Deleted.')));
return $this->getResponseNegotiator()->respond(
$this->request,
array('currentform' => array($this, 'EmptyForm'))
);
*/
echo '<script>window.location.reload();</script>';
return;
}

}

?>

0 comments on commit 43d7045

Please sign in to comment.