Permalink
Browse files

Reverted r111624

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@111625 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent ba163b8 commit 00a5a5bd5b31cf72bca9bf07b6c7e2125d4c90dd @sminnee sminnee committed Oct 4, 2010
@@ -66,8 +66,8 @@ function Link() {
function handleAction($request) {
// This method can't be called without ajax.
- if(!$this->parentController->isAjax()) {
- $this->parentController->redirectBack();
+ if(!Director::is_ajax()) {
+ Director::redirectBack();
return;
}
View
@@ -647,7 +647,7 @@ public function delete($data, $form) {
);
return ($liveRecord) ? $form->formHtmlContent() : "";
} else {
- $this->redirectBack();
+ Director::redirectBack();
}
}
@@ -917,7 +917,7 @@ function getversion() {
SSViewer::setOption('rewriteHashlinks', false);
- if($this->isAjax()) {
+ if(Director::is_ajax()) {
return $form->formHtmlContent();
} else {
$templateData = $this->customise(array(
View
@@ -83,7 +83,7 @@ function doImport($data, $form) {
$this->sessionMessage($msg, 'good');
- $this->redirectBack();
+ Director::redirectBack();
}
}
View
@@ -120,7 +120,7 @@ function init() {
);
// set reading lang
- if(Object::has_extension('SiteTree', 'Translatable') && !$this->isAjax()) {
+ if(Object::has_extension('SiteTree', 'Translatable') && !Director::is_ajax()) {
Translatable::choose_site_locale(array_keys(Translatable::get_existing_content_languages('SiteTree')));
}
@@ -158,7 +158,7 @@ function init() {
if(Director::redirected_to()) return;
// Audit logging hook
- if(empty($_REQUEST['executeForm']) && !$this->isAjax()) $this->extend('accessedCMS');
+ if(empty($_REQUEST['executeForm']) && !Director::is_ajax()) $this->extend('accessedCMS');
// Set the members html editor config
HtmlEditorConfig::set_active(Member::currentUser()->getHtmlEditorConfigForCMS());
@@ -360,7 +360,7 @@ public function show($request) {
// TODO Necessary for TableListField URLs to work properly
if($request->param('ID')) $this->setCurrentPageID($request->param('ID'));
- if($this->isAjax()) {
+ if(Director::is_ajax()) {
SSViewer::setOption('rewriteHashlinks', false);
$form = $this->getEditForm($request->param('ID'));
$content = $form->formHtmlContent();
@@ -87,7 +87,7 @@ function doImport($data, $form) {
$this->sessionMessage($msg, 'good');
- $this->controller->redirectBack();
+ Director::redirectBack();
}
/**
@@ -367,7 +367,7 @@ function saveComplexTableField($data, $form, $params) {
);
$form->sessionMessage($message, 'good');
- $this->controller->redirectBack();
+ Director::redirectBack();
}
/**
View
@@ -514,7 +514,7 @@ function import($data, $form, $request) {
// File wasn't properly uploaded, show a reminder to the user
if(empty($_FILES['_CsvFile']['tmp_name'])) {
$form->sessionMessage(_t('ModelAdmin.NOCSVFILE', 'Please browse for a CSV file to import'), 'good');
- $this->redirectBack();
+ Director::redirectBack();
return false;
}
@@ -541,7 +541,7 @@ function import($data, $form, $request) {
if(!$results->CreatedCount() && !$results->UpdatedCount()) $message .= _t('ModelAdmin.NOIMPORT', "Nothing to import");
$form->sessionMessage($message, 'good');
- $this->redirectBack();
+ Director::redirectBack();
}
/**
@@ -835,7 +835,7 @@ function doCreate($data, $form, $request) {
$form->saveInto($model);
$model->write();
- if($this->isAjax()) {
+ if(Director::is_ajax()) {
$class = $this->parentController->getRecordControllerClass($this->getModelClass());
$recordController = new $class($this, $request, $model->ID);
return new SS_HTTPResponse(
@@ -888,7 +888,7 @@ public function Link($action = null) {
*/
function edit($request) {
if ($this->currentRecord) {
- if($this->isAjax()) {
+ if(Director::is_ajax()) {
return new SS_HTTPResponse(
$this->EditForm()->formHtmlContent(),
200,
@@ -958,10 +958,10 @@ function doSave($data, $form, $request) {
// Behaviour switched on .
- if($this->parentController->isAjax()) {
+ if(Director::is_ajax()) {
return $this->edit($request);
} else {
- $this->parentController->redirectBack();
+ Director::redirectBack();
}
}
@@ -972,9 +972,8 @@ public function doDelete($data, $form, $request) {
if($this->currentRecord->canDelete(Member::currentUser())) {
$this->currentRecord->delete();
Director::redirect($this->parentController->Link('SearchForm?action=search'));
- } else {
- $this->parentController->redirectBack();
}
+ else Director::redirectBack();
return;
}
@@ -190,10 +190,10 @@ function deleteallcomments() {
}
}
- if($this->isAjax()) {
+ if(Director::is_ajax()) {
echo "";
} else {
- $this->redirectBack();
+ Director::redirectBack();
}
}
@@ -205,10 +205,10 @@ function deletecomment() {
}
}
- if($this->isAjax()) {
+ if(Director::is_ajax()) {
echo "";
} else {
- $this->redirectBack();
+ Director::redirectBack();
}
}
@@ -222,10 +222,10 @@ function approve() {
// @todo Report to spamprotecter this is true
- if($this->isAjax()) {
+ if(Director::is_ajax()) {
echo $comment->renderWith('PageCommentInterface_singlecomment');
} else {
- $this->redirectBack();
+ Director::redirectBack();
}
}
}
@@ -259,14 +259,14 @@ function reportspam() {
$comment->write();
}
}
- if($this->isAjax()) {
+ if(Director::is_ajax()) {
if(SSAkismet::isEnabled() && SSAkismet::getSaveSpam()) {
echo $comment->renderWith('PageCommentInterface_singlecomment');
} else {
echo '';
}
} else {
- $this->redirectBack();
+ Director::redirectBack();
}
}
/**
@@ -296,10 +296,10 @@ function reportham() {
$comment->write();
}
}
- if($this->isAjax()) {
+ if(Director::is_ajax()) {
echo $comment->renderWith('PageCommentInterface_singlecomment');
} else {
- $this->redirectBack();
+ Director::redirectBack();
}
}
@@ -301,8 +301,8 @@ function postcomment($data) {
//check if spam question was right.
if(MathSpamProtection::isEnabled()){
if(!MathSpamProtection::correctAnswer($data['Math'])){
- if(!$this->controller->isAjax()) {
- $this->controller->redirectBack();
+ if(!Director::is_ajax()) {
+ Director::redirectBack();
}
return "spamprotectionfailed"; //used by javascript for checking if the spam question was wrong
}
@@ -330,7 +330,7 @@ function postcomment($data) {
$comment->write();
Cookie::set("PageCommentInterface_Comment", '');
- if($this->controller->isAjax()) {
+ if(Director::is_ajax()) {
if($comment->NeedsModeration){
echo _t('PageCommentInterface_Form.AWAITINGMODERATION', "Your comment has been submitted and is now awaiting moderation.");
} else{
@@ -347,7 +347,7 @@ function postcomment($data) {
}
}
- return $this->controller->redirectBack(); // worst case, just go back to the page
+ return Director::redirectBack(); // worst case, just go back to the page
}
}
}
@@ -362,7 +362,7 @@ function __construct() {
}
function newspamquestion() {
- if($this->isAjax()) {
+ if(Director::is_ajax()) {
echo Convert::raw2xml(sprintf(_t('PageCommentInterface_Controller.SPAMQUESTION', "Spam protection question: %s"),MathSpamProtection::getMathQuestion()));
}
}

0 comments on commit 00a5a5b

Please sign in to comment.