MINOR Using SS_HTTPRequest->isAjax() instead of deprecated RequestHandler API

This commit is contained in:
Ingo Schommer 2012-04-05 14:45:26 +02:00
parent 108ea1d0e6
commit 3341a181c7
4 changed files with 8 additions and 8 deletions

View File

@ -255,7 +255,7 @@ JS
'EditForm' => $this->AddForm() 'EditForm' => $this->AddForm()
)); ));
if($this->isAjax()) { if($request->isAjax()) {
// Rendering is handled by template, which will call EditForm() eventually // Rendering is handled by template, which will call EditForm() eventually
$content = $obj->renderWith($this->getTemplatesWithSuffix('_Content')); $content = $obj->renderWith($this->getTemplatesWithSuffix('_Content'));
} else { } else {

View File

@ -9,7 +9,7 @@ class CMSFileAddController extends LeftAndMain {
// public function upload($request) { // public function upload($request) {
// $formHtml = $this->renderWith(array('AssetAdmin_UploadContent')); // $formHtml = $this->renderWith(array('AssetAdmin_UploadContent'));
// if($this->isAjax()) { // if($request->isAjax()) {
// return $formHtml; // return $formHtml;
// } else { // } else {
// return $this->customise(array( // return $this->customise(array(

View File

@ -47,7 +47,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
public function init() { public function init() {
// set reading lang // set reading lang
if(Object::has_extension('SiteTree', 'Translatable') && !$this->isAjax()) { if(Object::has_extension('SiteTree', 'Translatable') && !$this->request->isAjax()) {
Translatable::choose_site_locale(array_keys(Translatable::get_existing_content_languages('SiteTree'))); Translatable::choose_site_locale(array_keys(Translatable::get_existing_content_languages('SiteTree')));
} }
@ -139,7 +139,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
// Include custom CSS for tree icons inline, as the tree might be loaded // Include custom CSS for tree icons inline, as the tree might be loaded
// via Ajax, in which case we can't inject it into the HTML header easily through the HTTP response. // via Ajax, in which case we can't inject it into the HTML header easily through the HTTP response.
$css = $this->generateTreeStylingCSS(); $css = $this->generateTreeStylingCSS();
if($this->isAjax()) { if($this->request->isAjax()) {
$html .= "<style type=\"text/css\">\n" . $css . "</style>\n"; $html .= "<style type=\"text/css\">\n" . $css . "</style>\n";
} else { } else {
Requirements::customCSS($css); Requirements::customCSS($css);

View File

@ -27,7 +27,7 @@ class CMSPageHistoryController extends CMSMain {
function show($request) { function show($request) {
$form = $this->ShowVersionForm($request->param('VersionID')); $form = $this->ShowVersionForm($request->param('VersionID'));
if($this->isAjax()) { if($request->isAjax()) {
if($form) $content = $form->forTemplate(); if($form) $content = $form->forTemplate();
else $content = $this->renderWith($this->getTemplatesWithSuffix('_Content')); else $content = $this->renderWith($this->getTemplatesWithSuffix('_Content'));
} else { } else {
@ -44,7 +44,7 @@ class CMSPageHistoryController extends CMSMain {
$request->param('VersionID'), $request->param('VersionID'),
$request->param('OtherVersionID') $request->param('OtherVersionID')
); );
if($this->isAjax()) { if($request->isAjax()) {
$content = $form->forTemplate(); $content = $form->forTemplate();
} else { } else {
$content = $this->customise(array('EditForm' => $form))->renderWith($this->getViewer('show')); $content = $this->customise(array('EditForm' => $form))->renderWith($this->getViewer('show'));
@ -258,7 +258,7 @@ class CMSPageHistoryController extends CMSMain {
$form = $this->CompareVersionsForm($version1, $version2); $form = $this->CompareVersionsForm($version1, $version2);
// javascript solution, render into template // javascript solution, render into template
if($this->isAjax()) { if($this->request->isAjax()) {
return $this->customise(array( return $this->customise(array(
"EditForm" => $form "EditForm" => $form
))->renderWith(array( ))->renderWith(array(
@ -293,7 +293,7 @@ class CMSPageHistoryController extends CMSMain {
if(!$versionID) return; if(!$versionID) return;
if($this->isAjax()) { if($request->isAjax()) {
return $this->customise(array( return $this->customise(array(
"EditForm" => $this->ShowVersionForm($versionID) "EditForm" => $this->ShowVersionForm($versionID)
))->renderWith(array( ))->renderWith(array(