From f5007a553605f73d2f941d69141df84b63e42a94 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 16 Aug 2012 09:29:51 +0200 Subject: [PATCH 1/3] Allow extension of "add" link in CMS First use case is the "translatable" module --- code/controllers/CMSMain.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index 11b53ef6..45cfcdb7 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -203,7 +203,9 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr } function LinkPageAdd() { - return singleton("CMSPageAddController")->Link(); + $link = singleton("CMSPageAddController")->Link(); + $this->extend('updateLinkPageAdd', $link); + return $link; } /** From 2923e55c712530241ba79bdbca1ca793ae003588 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 16 Aug 2012 09:48:54 +0200 Subject: [PATCH 2/3] BUG Restrict URLSegment preview to editable fields This fixes a bug where the Translatable module would have a duplicate preview because it had another ".urlsegment" field showing the value in its original language. See https://github.com/silverstripe/silverstripe-translatable/issues/43 --- javascript/SiteTreeURLSegmentField.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/javascript/SiteTreeURLSegmentField.js b/javascript/SiteTreeURLSegmentField.js index 1d1a6e8f..2605ac5a 100644 --- a/javascript/SiteTreeURLSegmentField.js +++ b/javascript/SiteTreeURLSegmentField.js @@ -11,9 +11,13 @@ * Constructor: onmatch */ onmatch : function() { - this._addActions(); // add elements and actions for editing - this.edit(); // toggle - this._autoInputWidth(); // set width of input field + // Only initialize the field if it contains an editable field. + // This ensures we don't get bogus previews on readonly fields. + if(this.find(':text').length) { + this._addActions(); // add elements and actions for editing + this.edit(); // toggle + this._autoInputWidth(); // set width of input field + } this._super(); }, From c019f22163816a47cfbee6d8320ed762c1df9a9b Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Mon, 20 Aug 2012 15:22:13 +1200 Subject: [PATCH 3/3] Fix notice when ErrorPage tries to create static error pages and can't write --- code/model/ErrorPage.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/model/ErrorPage.php b/code/model/ErrorPage.php index 67548e82..16ac0ce6 100644 --- a/code/model/ErrorPage.php +++ b/code/model/ErrorPage.php @@ -88,6 +88,7 @@ class ErrorPage extends Page { // Ensure a static error page is created from latest error page content $response = Director::test(Director::makeRelative($pageNotFoundErrorPage->Link())); + $written = null; if($fh = fopen($pageNotFoundErrorPagePath, 'w')) { $written = fwrite($fh, $response->getBody()); fclose($fh); @@ -115,6 +116,7 @@ class ErrorPage extends Page { // Ensure a static error page is created from latest error page content $response = Director::test(Director::makeRelative($serverErrorPage->Link())); + $written = null; if($fh = fopen($serverErrorPagePath, 'w')) { $written = fwrite($fh, $response->getBody()); fclose($fh);