ENHANCEMENT Removed automatic redirection to admin URLs in ContentController, too counter-intuitive and hard to implement consistently, while still allowing linkage of pages without CMS around them. Use $SilverStripeNavigator in custom Page.ss to link a page to its admin view for logged-in users.

This commit is contained in:
Ingo Schommer 2011-07-21 11:50:50 +02:00
parent 6d26a88442
commit dacdade4b0
2 changed files with 3 additions and 10 deletions

View File

@ -1122,7 +1122,7 @@ class LeftAndMain extends Controller {
public function PreviewLink() {
$record = $this->getRecord($this->currentPageID());
$baseLink = ($record && $record instanceof Page) ? $record->Link('?stage=Stage') : Director::absoluteBaseURL();
return Controller::join_links($baseLink, '?cms-preview-disabled=1');
return $baseLink;
}
/**

View File

@ -47,7 +47,6 @@
// var url = ui.xmlhttp.getResponseHeader('x-frontend-url');
var url = $('.cms-edit-form').find(':input[name=StageURLSegment]').val();
if(url) {
url = url.replace(/\?.*/, '') + jQuery.query.load(url).set('cms-preview-disabled', '1').toString();
self.loadUrl(url);
self.unblock();
} else {
@ -109,14 +108,8 @@
var href = links[i].getAttribute('href');
if(!href) continue;
if (href.match(/^http:\/\//)) {
// Disable external links
links[i].setAttribute('href', 'javascript:false');
} else {
// Add GET parameter to internal links to avoid double redirects and infinitely nested CMS UIs
var previewUrl = href.replace(/\?.*/, '') + jQuery.query.load(href).set('cms-preview-disabled', '1').toString();
links[i].setAttribute('href', previewUrl);
}
// Disable external links
if (href.match(/^http:\/\//)) links[i].setAttribute('href', 'javascript:false');
}
},