Permalink
Browse files

ENHANCEMENT Removed automatic redirection to admin URLs in ContentCon…

…troller, 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.
  • Loading branch information...
1 parent 6d26a88 commit dacdade4b0c8628a482591702e98788f45037f50 @chillu chillu committed Jul 21, 2011
Showing with 3 additions and 10 deletions.
  1. +1 −1 admin/code/LeftAndMain.php
  2. +2 −9 admin/javascript/LeftAndMain.Preview.js
@@ -1122,7 +1122,7 @@ public function isCurrentPage(DataObject $record) {
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;
}
/**
@@ -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');
}
},

0 comments on commit dacdade

Please sign in to comment.