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 = '';
|
$descRemoved = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$form->sessionMessage(
|
$this->response->addHeader(
|
||||||
_t(
|
'X-Status',
|
||||||
'CMSMain.REMOVED',
|
sprintf(_t('CMSMain.REMOVED', 'Deleted \'%s\'%s from live site'), $recordTitle, $descRemoved)
|
||||||
'Deleted \'{title}\'{additionalinfo} from live site',
|
|
||||||
array('title' => $recordTitle, 'additionalinfo' => $descRemoved)
|
|
||||||
),
|
|
||||||
'good'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Even if the record has been deleted from stage and live, it can be viewed in "archive mode"
|
// 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;
|
$recordID = $record->ID;
|
||||||
$record->delete();
|
$record->delete();
|
||||||
|
|
||||||
$form->sessionMessage(
|
$this->response->addHeader(
|
||||||
_t('CMSMain.REMOVEDPAGEFROMDRAFT',"Removed '{title}' from the draft site", array('title' => $record->Title)),
|
'X-Status',
|
||||||
'good'
|
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"
|
// 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) {
|
function publish($data, $form) {
|
||||||
|
Loading…
Reference in New Issue
Block a user