From 119d8aa8924b3eff7c274fc630216b7be1f552ba Mon Sep 17 00:00:00 2001 From: UndefinedOffset Date: Fri, 1 Feb 2013 14:16:19 -0400 Subject: [PATCH 1/4] ENHANCEMENT: Do not display SilverStripeNavigator_CMSLink when in a LeftAndMain extension not just CMSMain extensions --- code/controllers/SilverStripeNavigator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/controllers/SilverStripeNavigator.php b/code/controllers/SilverStripeNavigator.php index 1bb23de8..1ce2e17d 100644 --- a/code/controllers/SilverStripeNavigator.php +++ b/code/controllers/SilverStripeNavigator.php @@ -196,12 +196,12 @@ class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem { } public function isActive() { - return (Controller::curr() instanceof CMSMain); + return (Controller::curr() instanceof LeftAndMain); } public function canView($member = null) { // Don't show in CMS - return !(Controller::curr() instanceof CMSMain); + return !(Controller::curr() instanceof LeftAndMain); } } From e56a78b1605ea958d844b4efca507074d5050c71 Mon Sep 17 00:00:00 2001 From: Michael Andrewartha Date: Mon, 4 Feb 2013 12:55:29 +0000 Subject: [PATCH 2/4] FIX: updateCMSFields not accepting var by reference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updateCMSFields should be taking the fields var by reference. @see https://github.com/silverstripe/sapphire/pull/1156 --- code/model/SiteTreeFileExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/model/SiteTreeFileExtension.php b/code/model/SiteTreeFileExtension.php index 4949ccf8..94794fca 100644 --- a/code/model/SiteTreeFileExtension.php +++ b/code/model/SiteTreeFileExtension.php @@ -9,7 +9,7 @@ class SiteTreeFileExtension extends DataExtension { 'BackLinkTracking' => 'SiteTree' ); - public function updateCMSFields(FieldList $fields) { + public function updateCMSFields(FieldList &$fields) { $fields->insertAfter(new ReadonlyField('BackLinkCount', _t('AssetTableField.BACKLINKCOUNT', 'Used on:'), $this->BackLinkTracking()->Count() . ' ' . _t('AssetTableField.PAGES', 'page(s)')), From 97fbfd3f128a1bfa1c27250e34bebd3e951d4051 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 4 Feb 2013 17:12:55 +0100 Subject: [PATCH 3/4] FIX Respect escaping rules on readonly fields in CMS history view Avoids showing unescaped HTML on fields which didn't allow it otherwise, e.g. TextField. This also fixes problems with SiteTree->ExtraMeta which got evaluated within the CMS. If this section contains any JavaScript it gets executed and can disrupt CMS operation. --- code/controllers/CMSPageHistoryController.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/code/controllers/CMSPageHistoryController.php b/code/controllers/CMSPageHistoryController.php index 846df975..9a8aca1e 100644 --- a/code/controllers/CMSPageHistoryController.php +++ b/code/controllers/CMSPageHistoryController.php @@ -113,11 +113,6 @@ class CMSPageHistoryController extends CMSMain { $fields = $fields->makeReadonly(); $navField->setAllowHTML(true); - foreach($fields->dataFields() as $field) { - $field->dontEscape = true; - $field->reserveNL = true; - } - if($compareID) { $link = Controller::join_links( $this->Link('show'), From a0e965b7b4d2dd29e6628d5444423a755ba89e71 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 6 Feb 2013 18:59:51 +0100 Subject: [PATCH 4/4] Revert "FIX: updateCMSFields not accepting var by reference" This reverts commit e56a78b1605ea958d844b4efca507074d5050c71. --- code/model/SiteTreeFileExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/model/SiteTreeFileExtension.php b/code/model/SiteTreeFileExtension.php index 94794fca..4949ccf8 100644 --- a/code/model/SiteTreeFileExtension.php +++ b/code/model/SiteTreeFileExtension.php @@ -9,7 +9,7 @@ class SiteTreeFileExtension extends DataExtension { 'BackLinkTracking' => 'SiteTree' ); - public function updateCMSFields(FieldList &$fields) { + public function updateCMSFields(FieldList $fields) { $fields->insertAfter(new ReadonlyField('BackLinkCount', _t('AssetTableField.BACKLINKCOUNT', 'Used on:'), $this->BackLinkTracking()->Count() . ' ' . _t('AssetTableField.PAGES', 'page(s)')),