ENHANCEMENT Setting $this->request in ModelAdmin_RecordController->edit() instead of returning new response, so it can be altered by subclasses

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@114144 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-11-24 06:24:03 +00:00
parent c579822340
commit 65b3b145f1

View File

@ -913,14 +913,15 @@ class ModelAdmin_RecordController extends Controller {
function edit($request) { function edit($request) {
if ($this->currentRecord) { if ($this->currentRecord) {
if($this->isAjax()) { if($this->isAjax()) {
return new SS_HTTPResponse( $this->response->setBody($this->EditForm()->formHtmlContent());
$this->EditForm()->formHtmlContent(), $this->response->setStatusCode(
200, 200,
sprintf( sprintf(
_t('ModelAdmin.LOADEDFOREDITING', "Loaded '%s' for editing."), _t('ModelAdmin.LOADEDFOREDITING', "Loaded '%s' for editing."),
$this->currentRecord->Title $this->currentRecord->Title
) )
); );
return $this->response;
} else { } else {
// This is really quite ugly; to fix will require a change in the way that customise() works. :-( // This is really quite ugly; to fix will require a change in the way that customise() works. :-(
return $this->parentController->parentController->customise(array( return $this->parentController->parentController->customise(array(
@ -928,7 +929,6 @@ class ModelAdmin_RecordController extends Controller {
'EditForm' => $this->EditForm() 'EditForm' => $this->EditForm()
))->renderWith(array("{$this->class}_right",'LeftAndMain_right')) ))->renderWith(array("{$this->class}_right",'LeftAndMain_right'))
))->renderWith(array('ModelAdmin','LeftAndMain')); ))->renderWith(array('ModelAdmin','LeftAndMain'));
return ;
} }
} else { } else {
return _t('ModelAdmin.ITEMNOTFOUND', "I can't find that item"); return _t('ModelAdmin.ITEMNOTFOUND', "I can't find that item");