From 436899adbff73c11e92942fd84ee8c5deaca99b5 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Tue, 28 Aug 2012 17:23:48 +1200 Subject: [PATCH 01/25] Add config fragment for new i18n ordering system --- _config/i18n.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 _config/i18n.yml diff --git a/_config/i18n.yml b/_config/i18n.yml new file mode 100644 index 00000000..4989e86b --- /dev/null +++ b/_config/i18n.yml @@ -0,0 +1,8 @@ +--- +Name: cmsi18n +Before: '/i18n' +After: '/i18n#basei18n' +--- +i18n: + module_priority: + - cms From 9403dd6e385ba5b1288eb33dee58fe0d2aedf1a7 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 16 Dec 2012 23:32:09 +0100 Subject: [PATCH 02/25] Respecting model permissions in AssetAdmin --- code/controllers/AssetAdmin.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/controllers/AssetAdmin.php b/code/controllers/AssetAdmin.php index e5e9cd7a..380452b2 100644 --- a/code/controllers/AssetAdmin.php +++ b/code/controllers/AssetAdmin.php @@ -156,7 +156,8 @@ JS GridFieldLevelup::create($folder->ID)->setLinkSpec('admin/assets/show/%d') ); - $gridField = new GridField('File', $title, $this->getList(), $gridFieldConfig); + $gridField = GridField::create('File', $title, $this->getList(), $gridFieldConfig) + ->setCheckModelPermissions(true); $columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns'); $columns->setDisplayFields(array( 'StripThumbnail' => '', From f212ebe0f05945992585fcfd268b671f0be9e588 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 28 Mar 2013 21:07:47 +0100 Subject: [PATCH 03/25] Simplified travis builds (external setup scripts) --- .travis.yml | 9 +++++---- tests/travis/before_script | 10 ---------- 2 files changed, 5 insertions(+), 14 deletions(-) delete mode 100755 tests/travis/before_script diff --git a/.travis.yml b/.travis.yml index 000cc5fd..4207d749 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,15 +3,16 @@ php: - 5.3 env: - - TESTDB=MYSQL - - TESTDB=PGSQL + - DB=MYSQL CORE_RELEASE=2.4 + - DB=PGSQL CORE_RELEASE=2.4 before_script: - - ./tests/travis/before_script ~/builds/ss + - git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support + - php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss - cd ~/builds/ss script: - - php sapphire/cli-script.php dev/tests/module/cms + - phpunit cms/tests branches: except: diff --git a/tests/travis/before_script b/tests/travis/before_script deleted file mode 100755 index ac9a6f0c..00000000 --- a/tests/travis/before_script +++ /dev/null @@ -1,10 +0,0 @@ -BUILD_DIR=$1 -git clone --depth=100 --branch 2.4 --quiet git://github.com/silverstripe/silverstripe-installer.git $BUILD_DIR -git clone --depth=100 --branch 1.2 --quiet git://github.com/silverstripe-labs/silverstripe-sqlite3.git $BUILD_DIR/sqlite3 -git clone --depth=100 --branch 1.0 --quiet git://github.com/silverstripe/silverstripe-postgresql.git $BUILD_DIR/postgresql -git clone --depth=100 --quiet --branch 2.4 git://github.com/silverstripe/sapphire.git $BUILD_DIR/sapphire -cp $BUILD_DIR/sapphire/tests/travis/_ss_environment.php $BUILD_DIR -cp $BUILD_DIR/sapphire/tests/travis/_config.php $BUILD_DIR/mysite -cp -r . $BUILD_DIR/cms - -cd $BUILD_DIR From b4f2e35b3266f95518a16ee307a5fb422567b336 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 30 Apr 2013 17:58:30 +1200 Subject: [PATCH 04/25] Updating text for permission description to be accurate for 3.x --- code/model/SiteTree.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index 50b5052b..264da89f 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -2758,7 +2758,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid 'name' => _t('SiteTree.VIEW_ALL_DESCRIPTION', 'View any page'), 'category' => _t('Permissions.CONTENT_CATEGORY', 'Content permissions'), 'sort' => -100, - 'help' => _t('SiteTree.VIEW_ALL_HELP', 'Ability to view any page on the site, regardless of the settings on the Access tab. Requires the "Access to Site Content" permission') + 'help' => _t('SiteTree.VIEW_ALL_HELP', 'Ability to view any page on the site, regardless of the settings on the Access tab. Requires the "Access to \'Pages\' section" permission') ), 'SITETREE_EDIT_ALL' => array( 'name' => _t('SiteTree.EDIT_ALL_DESCRIPTION', 'Edit any page'), From f8cfb5afd62404856623e886863b3b9d69435592 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 30 Apr 2013 19:09:16 +0300 Subject: [PATCH 05/25] composer/installers dep workaround Moved to end of requirements, to work around a bug in composer - see https://github.com/composer/composer/issues/1147. This caused the dependencies to be installed in the wrong folder because the custom 'silverstripe-module' instructions hadn't been loaded at the time the core modules were installed via composer. --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 12e1d781..5d3a6916 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=5.2.4", - "composer/installers": "*", - "silverstripe/framework": "2.4.*" + "silverstripe/framework": "2.4.*", + "composer/installers": "*" } -} \ No newline at end of file +} From c7ebf76757dd8172ef6bc7104d126b6e46d52afe Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 7 May 2013 16:04:24 +1200 Subject: [PATCH 06/25] Page history panel: show appropriate message when viewing latest version --- code/controllers/CMSPageHistoryController.php | 17 ++++++++++------- .../controller/CMSPageHistoryControllerTest.php | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/code/controllers/CMSPageHistoryController.php b/code/controllers/CMSPageHistoryController.php index d1402aca..9444f141 100644 --- a/code/controllers/CMSPageHistoryController.php +++ b/code/controllers/CMSPageHistoryController.php @@ -142,13 +142,16 @@ class CMSPageHistoryController extends CMSMain { ); $revert->setReadonly(true); - } - else { - $message = _t( - 'CMSPageHistoryController.VIEWINGVERSION', - "Currently viewing version {version}.", - array('version' => $versionID) - ); + } else { + if($record->isLatestVersion()) { + $message = _t('CMSPageHistoryController.VIEWINGLATEST', 'Currently viewing the latest version.'); + } else { + $message = _t( + 'CMSPageHistoryController.VIEWINGVERSION', + "Currently viewing version {version}.", + array('version' => $versionID) + ); + } } $fields->addFieldToTab('Root.Main', diff --git a/tests/controller/CMSPageHistoryControllerTest.php b/tests/controller/CMSPageHistoryControllerTest.php index 18f0d6d5..a79a6f71 100755 --- a/tests/controller/CMSPageHistoryControllerTest.php +++ b/tests/controller/CMSPageHistoryControllerTest.php @@ -52,7 +52,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest { $this->assertEquals($this->versionPublishCheck2, $form->Fields()->dataFieldByName('Version')->Value()); $this->assertContains( - sprintf("Currently viewing version %s.", $this->versionPublishCheck2), + 'Currently viewing the latest version', $form->Fields()->fieldByName('Root.Main.CurrentlyViewingMessage')->getContent() ); From 7ecf56490a406914608c828b93e64f6e189ae99c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 30 Apr 2013 16:54:18 +0200 Subject: [PATCH 07/25] FIX URL concat in tree actions (broke with 'translatable' module) --- javascript/CMSMain.AddForm.js | 8 ++++++-- javascript/CMSMain.Tree.js | 27 +++++++++++++++++--------- templates/Includes/CMSMain_TreeView.ss | 2 +- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/javascript/CMSMain.AddForm.js b/javascript/CMSMain.AddForm.js index 2c9004cf..03e66e52 100644 --- a/javascript/CMSMain.AddForm.js +++ b/javascript/CMSMain.AddForm.js @@ -98,8 +98,12 @@ if(state) parentId = parseInt(JSON.parse(state).ParentID, 10); } - var data = {selector: this.data('targetPanel'),pjax: this.data('pjax')}, - url = parentId ? ss.i18n.sprintf(this.data('urlAddpage'), parentId) : this.attr('href'); + var data = {selector: this.data('targetPanel'),pjax: this.data('pjax')}, url; + if(parentID) { + url = $.path.addSearchParams(ss.i18n.sprintf(this.data('urlAddpage'), parentId), this.data('extraParams')); + } else { + url = this.attr('href'); + } $('.cms-container').loadPanel(url, null, data); e.preventDefault(); diff --git a/javascript/CMSMain.Tree.js b/javascript/CMSMain.Tree.js index 6d98c8aa..67a273a5 100644 --- a/javascript/CMSMain.Tree.js +++ b/javascript/CMSMain.Tree.js @@ -60,9 +60,12 @@ 'label': '' + klassData.title, '_class': 'class-' + klass, 'action': function(obj) { - $('.cms-container').entwine('.ss').loadPanel(ss.i18n.sprintf( - self.data('urlAddpage'), id, klass - )); + $('.cms-container').entwine('.ss').loadPanel( + $.path.addSearchParams( + ss.i18n.sprintf(self.data('urlAddpage'), id, klass), + self.data('extraParams') + ) + ); } }; }); @@ -80,16 +83,22 @@ { 'label': ss.i18n._t('Tree.ThisPageOnly'), 'action': function(obj) { - $('.cms-container').entwine('.ss').loadPanel(ss.i18n.sprintf( - self.data('urlDuplicate'), obj.data('id') - )); + $('.cms-container').entwine('.ss').loadPanel( + $.path.addSearchParams( + ss.i18n.sprintf(self.data('urlDuplicate'), obj.data('id')), + self.data('extraParams') + ) + ); } },{ 'label': ss.i18n._t('Tree.ThisPageAndSubpages'), 'action': function(obj) { - $('.cms-container').entwine('.ss').loadPanel(ss.i18n.sprintf( - self.data('urlDuplicatewithchildren'), obj.data('id') - )); + $('.cms-container').entwine('.ss').loadPanel( + $.path.addSearchParams( + ss.i18n.sprintf(self.data('urlDuplicatewithchildren'), obj.data('id')), + self.data('extraParams') + ) + ); } } ] diff --git a/templates/Includes/CMSMain_TreeView.ss b/templates/Includes/CMSMain_TreeView.ss index 79e9c543..338d9463 100644 --- a/templates/Includes/CMSMain_TreeView.ss +++ b/templates/Includes/CMSMain_TreeView.ss @@ -19,7 +19,7 @@ $ExtraTreeTools <% end_if %> -
+
$SiteTreeAsUL
From 61312a5d7f2c2a792e7beed4c93e341fd3a7217a Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Fri, 10 May 2013 12:22:22 +1200 Subject: [PATCH 08/25] API Added SiteTreeExtension::updateRelativeLink Updated SiteTreeExtension PHPDoc Refactored out Translatable extension in RelativeLink --- code/model/SiteTree.php | 19 +++++------- code/model/SiteTreeExtension.php | 51 +++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 12 deletions(-) diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index 264da89f..239e885a 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -462,22 +462,19 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid public function RelativeLink($action = null) { if($this->ParentID && self::config()->nested_urls) { $base = $this->Parent()->RelativeLink($this->URLSegment); + } elseif(!$action && $this->URLSegment == RootURLController::get_homepage_link()) { + // Unset base for root-level homepages. + // Note: Homepages with action parameters (or $action === true) + // need to retain their URLSegment. + $base = null; } else { $base = $this->URLSegment; } - // Unset base for homepage URLSegments in their default language. - // Homepages with action parameters or in different languages - // need to retain their URLSegment. We can only do this if the homepage - // is on the root level. - if(!$action && $base == RootURLController::get_homepage_link() && !$this->ParentID) { - $base = null; - if(class_exists('Translatable') && $this->hasExtension('Translatable') && $this->Locale != Translatable::default_locale()){ - $base = $this->URLSegment; - } - } + $this->extend('updateRelativeLink', $base, $action); - // Legacy support + // Legacy support: If $action === true, retain URLSegment for homepages, + // but don't append any action if($action === true) $action = null; return Controller::join_links($base, '/', $action); diff --git a/code/model/SiteTreeExtension.php b/code/model/SiteTreeExtension.php index c800398f..f033e8ff 100644 --- a/code/model/SiteTreeExtension.php +++ b/code/model/SiteTreeExtension.php @@ -1,4 +1,5 @@ Date: Fri, 10 May 2013 14:05:06 +1200 Subject: [PATCH 09/25] FIX Escape the sitetree_link shortcode return value --- code/model/SiteTree.php | 6 ++++-- tests/model/SiteTreeTest.php | 8 ++++++++ tests/model/SiteTreeTest.yml | 10 +++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index 264da89f..bd8558f4 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -400,11 +400,13 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid ) { return; // There were no suitable matches at all. } + + $link = Convert::raw2att($page->Link()); if($content) { - return sprintf('%s', $page->Link(), $parser->parse($content)); + return sprintf('%s', $link, $parser->parse($content)); } else { - return $page->Link(); + return $link; } } diff --git a/tests/model/SiteTreeTest.php b/tests/model/SiteTreeTest.php index 18b07c4d..863e290b 100644 --- a/tests/model/SiteTreeTest.php +++ b/tests/model/SiteTreeTest.php @@ -554,6 +554,7 @@ class SiteTreeTest extends SapphireTest { public function testLinkShortcodeHandler() { $aboutPage = $this->objFromFixture('Page', 'about'); $errorPage = $this->objFromFixture('ErrorPage', '404'); + $redirectPage = $this->objFromFixture('RedirectorPage', 'external'); $parser = new ShortcodeParser(); $parser->register('sitetree_link', array('SiteTree', 'link_shortcode_handler')); @@ -580,6 +581,13 @@ class SiteTreeTest extends SapphireTest { $this->assertEquals($aboutShortcodeExpected, $parser->parse($aboutShortcode), 'Test link to 404 page if no suitable matches.'); $this->assertEquals($aboutEnclosedExpected, $parser->parse($aboutEnclosed)); + + $redirectShortcode = sprintf('[sitetree_link,id=%d]', $redirectPage->ID); + $redirectEnclosed = sprintf('[sitetree_link,id=%d]Example Content[/sitetree_link]', $redirectPage->ID); + $redirectExpected = 'http://www.google.com?a&b'; + + $this->assertEquals($redirectExpected, $parser->parse($redirectShortcode)); + $this->assertEquals(sprintf('Example Content', $redirectExpected), $parser->parse($redirectEnclosed)); $this->assertEquals('', $parser->parse('[sitetree_link]'), 'Test that invalid ID attributes are not parsed.'); $this->assertEquals('', $parser->parse('[sitetree_link,id="text"]')); diff --git a/tests/model/SiteTreeTest.yml b/tests/model/SiteTreeTest.yml index f4fe7275..f76c1be5 100644 --- a/tests/model/SiteTreeTest.yml +++ b/tests/model/SiteTreeTest.yml @@ -79,4 +79,12 @@ SiteTreeTest_Conflicted: ErrorPage: 404: Title: Page not Found - ErrorCode: 404 \ No newline at end of file + ErrorCode: 404 + +RedirectorPage: + external: + Title: External + URLSegment: external + RedirectionType: External + ExternalURL: "http://www.google.com?a&b" + From 7c68414fe75138dfd2e427d872faa65a9d5e60c6 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Sat, 11 May 2013 19:29:47 +1200 Subject: [PATCH 10/25] FIX: Rename search locale variable to avoid conflicts with locale switcher. Fixes http://open.silverstripe.org/ticket/6204 --- code/search/SearchForm.php | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/code/search/SearchForm.php b/code/search/SearchForm.php index f20054c1..8ee7b105 100644 --- a/code/search/SearchForm.php +++ b/code/search/SearchForm.php @@ -43,7 +43,7 @@ class SearchForm extends Form { } if(class_exists('Translatable') && singleton('SiteTree')->hasExtension('Translatable')) { - $fields->push(new HiddenField('locale', 'locale', Translatable::get_current_locale())); + $fields->push(new HiddenField('searchlocale', 'searchlocale', Translatable::get_current_locale())); } if(!$actions) { @@ -101,11 +101,18 @@ class SearchForm extends Form { if(!isset($data) || !is_array($data)) $data = $_REQUEST; // set language (if present) - if(class_exists('Translatable') && singleton('SiteTree')->hasExtension('Translatable') && isset($data['locale'])) { - $origLocale = Translatable::get_current_locale(); - Translatable::set_current_locale($data['locale']); + if(class_exists('Translatable')) { + if(singleton('SiteTree')->hasExtension('Translatable') && isset($data['searchlocale'])) { + if($data['searchlocale'] == "ALL") { + Translatable::disable_locale_filter(); + } else { + $origLocale = Translatable::get_current_locale(); + + Translatable::set_current_locale($data['searchlocale']); + } + } } - + $keywords = $data['Search']; $andProcessor = create_function('$matches',' @@ -137,8 +144,14 @@ class SearchForm extends Form { } // reset locale - if(class_exists('Translatable') && singleton('SiteTree')->hasExtension('Translatable') && isset($data['locale'])) { - Translatable::set_current_locale($origLocale); + if(class_exists('Translatable')) { + if(singleton('SiteTree')->hasExtension('Translatable') && isset($data['searchlocale'])) { + if($data['searchlocale'] == "ALL") { + Translatable::enable_locale_filter(); + } else { + Translatable::set_current_locale($origLocale); + } + } } return $results; From b88f56dfd8ad0b7b2fc618bed36a08735dd5861a Mon Sep 17 00:00:00 2001 From: Zauberfisch Date: Sat, 11 May 2013 18:57:53 +0000 Subject: [PATCH 11/25] Reverted 04bb85a78da801c5d0220a38f91e3be09b4e4a30 --- lang/lc_XX.yml | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 lang/lc_XX.yml diff --git a/lang/lc_XX.yml b/lang/lc_XX.yml new file mode 100644 index 00000000..0758a584 --- /dev/null +++ b/lang/lc_XX.yml @@ -0,0 +1,54 @@ +lc_XX: + ContentController: + DRAFT_SITE_ACCESS_RESTRICTION: "U MUST LOG IN WIF UR CMS PASWORD IN ORDR 2 VIEW TEH DRAFT OR ARCHIVD CONTENT. CLICK HEAR 2 GO BAK 2 TEH PUBLISHD SIET." + ErrorPage: + CODE: "TEH ERRUR CODE" + Folder: + UNUSEDFILESTITLE: "UNUSD FILEZ" + RedirectorPage: + HASBEENSETUP: "A REDIRECTOR PAEG HAS BEEN SET UP WITHOUT ANYWHERE 2 REDIRECT 2." + HEADER: "DIS PAEG WILL REDIRECT USERS 2 ANOTHR PAEG" + OTHERURL: "UDDR WEBSITEZ URL" + REDIRECTTO: "REDIRECT 2" + REDIRECTTOEXTERNAL: "ANOTHR WEBSIET" + REDIRECTTOPAGE: "A PAEG ON UR WEBSEIT" + YOURPAGE: "PAEG ON UR WEBSEIT" + SiteTree: + ACCESSANYONE: "ANY1" + ACCESSHEADER: "WAT PEEPS CAN C DAT PAEG ON MY SITE?" + ACCESSLOGGEDIN: "LOGGD-IN USERS" + ACCESSONLYTHESE: "ONLY THEES PEEPS (CHOOSE FRUM LIST)" + ALLOWCOMMENTS: "ALLOW COMMENTZ ON DIS PAEG?" + APPEARSVIRTUALPAGES: "DIS CONTENT ALSO APPEARz ON TEH VIRTUAL PAGEZ IN DA %s SECSHUNS." + BUTTONCANCELDRAFT: "CANCEL DRAFT CHANGEZ" + BUTTONCANCELDRAFTDESC: "DELETE UR DRAFT AN REVERT 2 TEH CURRENTLY PUBLISHD PAEG" + BUTTONSAVEPUBLISH: "SAV N PUBLISH" + BUTTONUNPUBLISH: "UNPUBLISH" + BUTTONUNPUBLISHDESC: "REMOOV DIS PAEG FRUM TEH PUBLISHD SIET" + EDITANYONE: "ANYONE HOO CAN LOG-IN 2 TEH CMS" + EDITHEADER: "WAT PEEPS CAN EDIT DIS INSIDE TEH CMS?" + EDITONLYTHESE: "ONLY THEEZ PEEPS (CHOOSE FRUM LIST)" + HASBROKENLINKS: | + DIS PAEG HAS BROKD LINKZ. + + HTMLEDITORTITLE: "TEH CONTENT" + MENUTITLE: "NAVIGASHUN LABEL" + METADESC: "DESCRIPSHUN" + METAEXTRA: "CUSTOM META TAGZ" + METAKEYWORDS: "KEYWURDZ" + METATITLE: "TITLE" + PAGETITLE: "NAYM OV TEH PAEG" + PAGETYPE: "TYPE OV TEH PAEG" + SHOWINMENUS: "SHOU IN MENUZ?" + SHOWINSEARCH: "SHOU IN SEARCH?" + TABACCESS: "ACCESZ" + TABBEHAVIOUR: "BEHAVIOUR" + TABCONTENT: "CONTENT" + TABMETA: "META-DATA" + TOPLEVEL: | + SIET CONTENT (TOP LEVEL) + + VirtualPage: + CHOOSE: "CHOOSE PAEG 2 LINK 2" + EDITCONTENT: "kLICK HEER 2 EDIT TEH CONTENT" + HEADER: "DIS R A VIRTUAL PAEG" From 4f88dcbbfc0026a6807c79a49ece1dcc183b62d6 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Mon, 13 May 2013 16:24:00 +1200 Subject: [PATCH 12/25] BUG ShowUnpublished checkbox with initial state not working If ShowUnpublished checkbox initial state is checked, the history doesn't show the unpublished versions up front. The user would need to uncheck the box then check again, as only the change event would handle the toggling of showing unpublished versions. Moved the ShowUnpublished handler into a separate entwine class, and run the same toggle code onmatch, as well as onchange. --- javascript/CMSPageHistoryController.js | 54 +++++++++++++++++--------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/javascript/CMSPageHistoryController.js b/javascript/CMSPageHistoryController.js index 2a66b397..d441ae8c 100644 --- a/javascript/CMSPageHistoryController.js +++ b/javascript/CMSPageHistoryController.js @@ -8,6 +8,7 @@ */ $.entwine('ss', function($){ + /** * Class: #Form_VersionsForm * @@ -19,24 +20,6 @@ * Constructor */ onmatch: function() { - var self = this; - - /** - * Event: :input[name=ShowUnpublished] change - * - * Changing the show unpublished checkbox toggles whether to show - * or hide the unpublished versions. Because those rows may be being - * compared this also ensures those rows are unselected. - */ - this.find(':input[name=ShowUnpublished]').bind('change', function(e) { - if($(this).attr("checked")) { - self.find("tr[data-published=false]").show(); - } - else { - self.find("tr[data-published=false]").hide()._unselect(); - } - }); - this._super(); }, onunmatch: function() { @@ -83,6 +66,41 @@ } }); + /** + * Class: :input[name=ShowUnpublished] + * + * Used for toggling whether to show or hide unpublished versions. + */ + $('#Form_VersionsForm input[name=ShowUnpublished]').entwine({ + onmatch: function() { + this.toggle(); + this._super(); + }, + onunmatch: function() { + this._super(); + }, + /** + * Event: :input[name=ShowUnpublished] change + * + * Changing the show unpublished checkbox toggles whether to show + * or hide the unpublished versions. Because those rows may be being + * compared this also ensures those rows are unselected. + */ + onchange: function() { + this.toggle(); + }, + toggle: function() { + var self = $(this); + var form = self.parents('form'); + + if(self.attr('checked')) { + form.find('tr[data-published=false]').show(); + } else { + form.find("tr[data-published=false]").hide()._unselect(); + } + } + }); + /** * Class: #Form_VersionsForm tr * From a681b8e4ab049b857aa022fd5b7896d0dec0ceed Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 14 May 2013 00:06:09 +1200 Subject: [PATCH 13/25] BUG Don't redirect to ErrorPage in CMS with x-cms-edit-link --- code/model/SiteTree.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index bd8558f4..89a2d300 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -1307,8 +1307,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid if($this->ExtraMeta) { $tags .= $this->ExtraMeta . "\n"; } - - if(Permission::check('CMS_ACCESS_CMSMain') && in_array('CMSPreviewable', class_implements($this))) { + + if(Permission::check('CMS_ACCESS_CMSMain') && in_array('CMSPreviewable', class_implements($this)) && !$this instanceof ErrorPage) { $tags .= "ID}\" />\n"; $tags .= "CMSEditLink() . "\" />\n"; } From f51448ced4fd566a5b81f0b063eb1559ab054d11 Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Tue, 14 May 2013 15:38:07 +0100 Subject: [PATCH 14/25] FIX 'Add new' page button missing ParentID Slight typo causing this. Also slightly amended how extra URL parameters are tagged on to prevent &undefined being appended to URL --- javascript/CMSMain.AddForm.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/javascript/CMSMain.AddForm.js b/javascript/CMSMain.AddForm.js index 03e66e52..08e62d6b 100644 --- a/javascript/CMSMain.AddForm.js +++ b/javascript/CMSMain.AddForm.js @@ -99,8 +99,9 @@ } var data = {selector: this.data('targetPanel'),pjax: this.data('pjax')}, url; - if(parentID) { - url = $.path.addSearchParams(ss.i18n.sprintf(this.data('urlAddpage'), parentId), this.data('extraParams')); + if(parentId) { + extraParams = this.data('extraParams') ? this.data('extraParams') : ''; + url = $.path.addSearchParams(ss.i18n.sprintf(this.data('urlAddpage'), parentId), extraParams); } else { url = this.attr('href'); } From 6117057c593c909408c48ec60dea335c7c77801d Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Wed, 15 May 2013 14:13:01 +1200 Subject: [PATCH 15/25] Update doRollback messages to work well with the new reverts. Currently reverts are not creating the new versions anymore - they are simply copying the Version over. Remove incorrect message about new version creation and remove the "cancel draft changes" message that's not correct. --- code/controllers/CMSMain.php | 9 ++++----- lang/en.yml | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index fbe29135..cf7209fd 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -1092,15 +1092,14 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr if($version) { $record->doRollbackTo($version); $message = _t( - 'CMSMain.ROLLEDBACKVERSION', - "Rolled back to version #%d. New version number is #%d", - array('version' => $data['Version'], 'versionnew' => $record->Version) + 'CMSMain.ROLLEDBACKVERSIONv2', + "Rolled back to version #%d.", + array('version' => $data['Version']) ); } else { $record->doRollbackTo('Live'); $message = _t( - 'CMSMain.ROLLEDBACKPUB',"Rolled back to published version. New version number is #{version}", - array('version' => $record->Version) + 'CMSMain.ROLLEDBACKPUBv2',"Rolled back to published version." ); } diff --git a/lang/en.yml b/lang/en.yml index f0cda7bf..30c55b4b 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -101,8 +101,8 @@ en: RESTORE: Restore RESTORED: 'Restored ''{title}'' successfully' ROLLBACK: 'Roll back to this version' - ROLLEDBACKPUB: 'Rolled back to published version. New version number is #{version}' - ROLLEDBACKVERSION: 'Rolled back to version #%d. New version number is #%d' + ROLLEDBACKPUBv2: 'Rolled back to published version.' + ROLLEDBACKVERSIONv2: 'Rolled back to version #%d.' SAVE: Save SAVEDRAFT: 'Save Draft' TabContent: Content From 2567cda0b4050f4163074dbde7952d5253aa46be Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Thu, 16 May 2013 20:11:22 +1200 Subject: [PATCH 16/25] Use $MenuTitle for Breadcrumbs (Fixes #743) --- templates/BreadcrumbsTemplate.ss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/BreadcrumbsTemplate.ss b/templates/BreadcrumbsTemplate.ss index b4314d31..beee98e2 100644 --- a/templates/BreadcrumbsTemplate.ss +++ b/templates/BreadcrumbsTemplate.ss @@ -1,5 +1,5 @@ <% if Pages %> <% loop Pages %> - <% if Last %>$Title.XML<% else %>$MenuTitle.XML »<% end_if %> + <% if Last %>$MenuTitle.XML<% else %>$MenuTitle.XML »<% end_if %> <% end_loop %> -<% end_if %> \ No newline at end of file +<% end_if %> From bccd2f8e512c9cd9b7a9ee038aa00b0cd390abad Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Fri, 17 May 2013 14:57:17 +1200 Subject: [PATCH 17/25] API Add a missing alternatePreviewLink hook for SiteTree extensions. --- code/model/SiteTree.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index 89a2d300..0d5d39e2 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -446,7 +446,11 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid * @return string */ public function PreviewLink($action = null) { - return $this->AbsoluteLink($action); + if($this->hasMethod('alternatePreviewLink')) { + return $this->alternatePreviewLink($action); + } else { + return $this->AbsoluteLink($action); + } } /** From 041a8bd5a7375608205b48680d2e47a26d781c7f Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 17 May 2013 13:30:33 +0200 Subject: [PATCH 18/25] Update github path --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d2af61e9..98a1b401 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://secure.travis-ci.org/silverstripe/silverstripe-cms.png?branch=3.0)](http://travis-ci.org/silverstripe/silverstripe-cms) -PHP5 Content Management System (CMS), see [http://silverstripe.org](http://silverstripe.org). Requires the [`framework`](http://github.com/silverstripe/sapphire) module and a [`silverstripe-installer`](http://github.com/silverstripe/silverstripe-installer) base project. +PHP5 Content Management System (CMS), see [http://silverstripe.org](http://silverstripe.org). Requires the [`framework`](http://github.com/silverstripe/silverstripe-framework) module and a [`silverstripe-installer`](http://github.com/silverstripe/silverstripe-installer) base project. ## Installation ## @@ -22,7 +22,7 @@ If you would like to make changes to the SilverStripe core codebase, we have an * [Requirements](http://doc.silverstripe.org/framework/en/installation/server-requirements) * [Changelogs](http://doc.silverstripe.org/framework/en/changelogs/) - * [Bugtracker: Framework](https://github.com/silverstripe/sapphire/issues) + * [Bugtracker: Framework](https://github.com/silverstripe/silverstripe-framework/issues) * [Bugtracker: CMS](https://github.com/silverstripe/silverstripe-cms/issues) * [Bugtracker: Installer](https://github.com/silverstripe/silverstripe-installer/issues) * [Forums](http://silverstripe.org/forums) From 3cc6485c14bd8eb88b512131fa62f21e1d731228 Mon Sep 17 00:00:00 2001 From: Matt Peel Date: Tue, 21 May 2013 14:57:29 +1200 Subject: [PATCH 19/25] Add default params to _t() calls to ensure if a translation isn't found, it falls back to a useful English string --- javascript/CMSMain.Tree.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/javascript/CMSMain.Tree.js b/javascript/CMSMain.Tree.js index 73b41c5c..fb1b634f 100644 --- a/javascript/CMSMain.Tree.js +++ b/javascript/CMSMain.Tree.js @@ -29,7 +29,7 @@ var menuitems = { 'edit': { - 'label': ss.i18n._t('Tree.EditPage'), + 'label': ss.i18n._t('Tree.EditPage', 'Edit page', 100, 'Used in the context menu when right-clicking on a page node in the CMS tree'), 'action': function(obj) { $('.cms-container').entwine('.ss').loadPanel(ss.i18n.sprintf( self.data('urlEditpage'), obj.data('id') @@ -40,7 +40,7 @@ // Test if there are any allowed Children and thus the possibility of adding some if(allowedChildren.hasOwnProperty('allowedchildren-0')) { menuitems['addsubpage'] = { - 'label': ss.i18n._t('Tree.AddSubPage'), + 'label': ss.i18n._t('Tree.AddSubPage', 'Add page under this page', 100, 'Used in the context menu when right-clicking on a page node in the CMS tree'), 'submenu': allowedChildren }; } From cd81d327ac89adc6851fafadccfb87d9854b4379 Mon Sep 17 00:00:00 2001 From: Fred Condo Date: Thu, 9 May 2013 11:48:45 -0700 Subject: [PATCH 20/25] Return 410 for successfullyinstalled after install files are gone It was possible to append '/successfullyinstalled' to any SilverStripe URL (with the cms module present), and the code would run, including republishing the 404 page. Now, if the install.php file is gone, this controller method throws the 410 (Gone) status code. The 410 status is chosen rather than 404 to mitigate the likelihood that crawlers such as the Googlebot will follow stray links to this URI. --- code/controllers/ContentController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/controllers/ContentController.php b/code/controllers/ContentController.php index 82e91355..2cd3f418 100644 --- a/code/controllers/ContentController.php +++ b/code/controllers/ContentController.php @@ -372,6 +372,10 @@ HTML; * This action is called by the installation system */ public function successfullyinstalled() { + // Return 410 Gone if this site is not actually a fresh installation + if (!file_exists(BASE_PATH . '/install.php')) { + $this->httpError(410); + } // The manifest should be built by now, so it's safe to publish the 404 page $fourohfour = Versioned::get_one_by_stage('ErrorPage', 'Stage', '"ErrorCode" = 404'); if($fourohfour) { From 9281ebc64764a58f86f685f9765e1d8b60995e5a Mon Sep 17 00:00:00 2001 From: Russell Michell Date: Thu, 23 May 2013 14:48:24 +1200 Subject: [PATCH 21/25] BUGFIX: Content authors with SiteTree#canView() but not SiteTree#canEdit() were unable to click on SiteTree items in the CMS. - The 'disabled' attribute in
  • will now only render if the author _really_ can't do _anything_ --- code/model/SiteTree.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index fbe99aa8..04af9b6d 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -2657,7 +2657,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid if(!$this->canAddChildren()) $classes .= " nochildren"; - if(!$this->canEdit() && !$this->canAddChildren()) + if(!$this->canView() && !$this->canEdit() && !$this->canAddChildren()) $classes .= " disabled"; if(!$this->ShowInMenus) From 698a75d903e922fec12bfa7e8d744780283a3e25 Mon Sep 17 00:00:00 2001 From: jean Date: Sat, 25 May 2013 11:37:26 +1200 Subject: [PATCH 22/25] FIX Correct page title shown when restoring a page, instead of html of tree node --- code/controllers/CMSMain.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index cf7209fd..87d7358a 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -1259,7 +1259,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr rawurlencode(_t( 'CMSMain.RESTORED', "Restored '{title}' successfully", - array('title' => $restoredPage->TreeTitle) + array('title' => $restoredPage->Title) )) ); From e8f6b416d79e064316fa09fe7d0ba64f53433c20 Mon Sep 17 00:00:00 2001 From: Simon Welsh Date: Sat, 25 May 2013 13:56:02 +1200 Subject: [PATCH 23/25] Revert call to setCheckModelPermissions() --- code/controllers/AssetAdmin.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/controllers/AssetAdmin.php b/code/controllers/AssetAdmin.php index 27deb75e..477f2378 100644 --- a/code/controllers/AssetAdmin.php +++ b/code/controllers/AssetAdmin.php @@ -158,8 +158,7 @@ JS GridFieldLevelup::create($folder->ID)->setLinkSpec('admin/assets/show/%d') ); - $gridField = GridField::create('File', $title, $this->getList(), $gridFieldConfig) - ->setCheckModelPermissions(true); + $gridField = GridField::create('File', $title, $this->getList(), $gridFieldConfig); $columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns'); $columns->setDisplayFields(array( 'StripThumbnail' => '', From 20f044cef0d0b247110c7be5e26791ba30d41e52 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Sun, 26 May 2013 12:31:15 +1200 Subject: [PATCH 24/25] BUG Fixing regression from silverstripe/sapphire/67d1327 Status flag classes didn't pick up styling because the flag was changed to prefix "status-". --- code/model/SiteTree.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index 04af9b6d..293425a7 100644 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -2621,7 +2621,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid if(is_string($data)) $data = array('text' => $data); $treeTitle .= sprintf( "%s", - Convert::raw2xml($class), + 'status-' . Convert::raw2xml($class), (isset($data['title'])) ? sprintf(' title="%s"', Convert::raw2xml($data['title'])) : '', Convert::raw2xml($data['text']) ); From 85f5a45951983200652a9c009aecd9b29bacb36d Mon Sep 17 00:00:00 2001 From: Mike Parkhill Date: Mon, 27 May 2013 17:21:07 +1200 Subject: [PATCH 25/25] FIX #651 Broken redirection after creating new folder in assets --- code/controllers/AssetAdmin.php | 1 + 1 file changed, 1 insertion(+) diff --git a/code/controllers/AssetAdmin.php b/code/controllers/AssetAdmin.php index 477f2378..c5453026 100644 --- a/code/controllers/AssetAdmin.php +++ b/code/controllers/AssetAdmin.php @@ -491,6 +491,7 @@ JS return $folder; } } + $this->setCurrentPageID(null); return new Folder(); }