mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
BUGFIX: unify the response method for record deletions (os7212)
sessionMessage is an old way of returning responses - the consistent way of doing this is now X-Status header, which then gets distrubuted via JS in the CMS frontend.
This commit is contained in:
parent
de9005e0c2
commit
1f992c5e34
@ -888,17 +888,13 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
$descRemoved = '';
|
||||
}
|
||||
|
||||
$form->sessionMessage(
|
||||
_t(
|
||||
'CMSMain.REMOVED',
|
||||
'Deleted \'{title}\'{additionalinfo} from live site',
|
||||
array('title' => $recordTitle, 'additionalinfo' => $descRemoved)
|
||||
),
|
||||
'good'
|
||||
$this->response->addHeader(
|
||||
'X-Status',
|
||||
sprintf(_t('CMSMain.REMOVED', 'Deleted \'%s\'%s from live site'), $recordTitle, $descRemoved)
|
||||
);
|
||||
|
||||
|
||||
// Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
|
||||
return $this->redirect(Controller::join_links($this->Link('show'), $recordID));
|
||||
return $this->getResponseNegotiator()->respond($this->request);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -967,13 +963,13 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
$recordID = $record->ID;
|
||||
$record->delete();
|
||||
|
||||
$form->sessionMessage(
|
||||
_t('CMSMain.REMOVEDPAGEFROMDRAFT',"Removed '{title}' from the draft site", array('title' => $record->Title)),
|
||||
'good'
|
||||
$this->response->addHeader(
|
||||
'X-Status',
|
||||
sprintf(_t('CMSMain.REMOVEDPAGEFROMDRAFT',"Removed '%s' from the draft site"), $record->Title)
|
||||
);
|
||||
|
||||
|
||||
// Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
|
||||
return $this->redirect(Controller::join_links($this->Link('show'), $recordID));
|
||||
return $this->getResponseNegotiator()->respond($this->request);
|
||||
}
|
||||
|
||||
function publish($data, $form) {
|
||||
|
Loading…
Reference in New Issue
Block a user