Merge pull request #123 from mateusz/silverstripe-cms

---

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.

Accompanies https://github.com/silverstripe/sapphire/pull/423
This commit is contained in:
Ingo Schommer 2012-05-10 10:28:31 +02:00
commit 4cff4277fc

View File

@ -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) {