From 8ba7070b02b4941520a2afc9d4ebde34c6e4d85e Mon Sep 17 00:00:00 2001 From: Michael van Schaik Date: Tue, 27 Sep 2022 06:12:48 +0200 Subject: [PATCH 1/4] Switch to listing views of subsite-filtered sections Fixes #489 --- client/javascript/LeftAndMain_Subsites.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/javascript/LeftAndMain_Subsites.js b/client/javascript/LeftAndMain_Subsites.js index 8dd2b24..4164129 100644 --- a/client/javascript/LeftAndMain_Subsites.js +++ b/client/javascript/LeftAndMain_Subsites.js @@ -7,7 +7,13 @@ $('#SubsitesSelect').entwine({ onadd:function(){ this.on('change', function(){ - window.location.search=$.query.set('SubsiteID', $(this).val()); + // Switch to listing views of subsite-filtered sections (eg: pages/ & assets/) + let newLocHref = window.location.href + .split('edit/show/').shift() // remove [pages/]edit/etc + .split('settings/show/').shift() // remove [pages/]settings/etc + .split('history/show/').shift() // remove [pages/]history/etc + .split('show/').shift(); // remove [assets/]show/102/edit/etc (last as 'show' is broad) + window.location.href = newLocHref + $.query.set('SubsiteID', $(this).val()).toString(); }); } }); From e02076609543732432aac88aba6564222980fdd6 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 6 Sep 2023 17:26:00 +1200 Subject: [PATCH 2/4] Revert "Switch to listing views of subsite-filtered sections" This reverts commit 8ba7070b02b4941520a2afc9d4ebde34c6e4d85e. --- client/javascript/LeftAndMain_Subsites.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/client/javascript/LeftAndMain_Subsites.js b/client/javascript/LeftAndMain_Subsites.js index 4164129..8dd2b24 100644 --- a/client/javascript/LeftAndMain_Subsites.js +++ b/client/javascript/LeftAndMain_Subsites.js @@ -7,13 +7,7 @@ $('#SubsitesSelect').entwine({ onadd:function(){ this.on('change', function(){ - // Switch to listing views of subsite-filtered sections (eg: pages/ & assets/) - let newLocHref = window.location.href - .split('edit/show/').shift() // remove [pages/]edit/etc - .split('settings/show/').shift() // remove [pages/]settings/etc - .split('history/show/').shift() // remove [pages/]history/etc - .split('show/').shift(); // remove [assets/]show/102/edit/etc (last as 'show' is broad) - window.location.href = newLocHref + $.query.set('SubsiteID', $(this).val()).toString(); + window.location.search=$.query.set('SubsiteID', $(this).val()); }); } }); From fbeff6d879bbae7936dd0f5fe83cc5f7cfe9f652 Mon Sep 17 00:00:00 2001 From: Sabina Talipova Date: Fri, 13 Oct 2023 11:42:31 +1300 Subject: [PATCH 3/4] MNT Remove TODO comments --- client/src/js/LeftAndMain_Subsites.js | 3 --- client/src/js/SubsitesTreeDropdownField.js | 1 - src/Extensions/ErrorPageSubsite.php | 13 +------------ src/Extensions/FileSubsites.php | 5 +---- src/Extensions/SiteTreeSubsites.php | 3 --- src/Forms/GridFieldSubsiteDetailFormItemRequest.php | 4 ---- src/Model/Subsite.php | 2 -- src/Model/SubsiteDomain.php | 3 --- tests/php/SiteTreeSubsitesTest.php | 2 -- 9 files changed, 2 insertions(+), 34 deletions(-) diff --git a/client/src/js/LeftAndMain_Subsites.js b/client/src/js/LeftAndMain_Subsites.js index 57be90a..3c8b609 100644 --- a/client/src/js/LeftAndMain_Subsites.js +++ b/client/src/js/LeftAndMain_Subsites.js @@ -61,9 +61,6 @@ }); $('.cms-edit-form').entwine({ - /** - * TODO: Fix with Entwine API extension. See https://github.com/silverstripe/silverstripe-subsites/pull/125 - */ getChangeTrackerOptions() { // Figure out if we're still returning the default value const isDefault = (this.entwineData('ChangeTrackerOptions') === undefined); diff --git a/client/src/js/SubsitesTreeDropdownField.js b/client/src/js/SubsitesTreeDropdownField.js index cddf2d5..472f7af 100644 --- a/client/src/js/SubsitesTreeDropdownField.js +++ b/client/src/js/SubsitesTreeDropdownField.js @@ -8,7 +8,6 @@ */ $('select.subsitestreedropdownfield-chooser').entwine({ onchange() { - // TODO Data binding between two fields const name = this.attr('name').replace('_SubsiteID', ''); const field = $(`#Form_EditForm_${name}`).first(); field.setValue(0); diff --git a/src/Extensions/ErrorPageSubsite.php b/src/Extensions/ErrorPageSubsite.php index 2f5c41f..6bf8bed 100644 --- a/src/Extensions/ErrorPageSubsite.php +++ b/src/Extensions/ErrorPageSubsite.php @@ -48,18 +48,7 @@ class ErrorPageSubsite extends DataExtension $subdomainPart = "-{$subdomain}"; } - // @todo implement Translatable namespace - if (singleton(SiteTree::class)->hasExtension('Translatable') - && $locale - && $locale != Translatable::default_locale() - ) { - $fileName = "error-{$statusCode}-{$locale}{$subdomainPart}.html"; - } else { - $fileName= "error-{$statusCode}{$subdomainPart}.html"; - } - - $fileName = FileNameFilter::create()->filter($fileName); - + $fileName = FileNameFilter::create()->filter("error-{$statusCode}{$subdomainPart}.html"); $name = implode('/', [$static_filepath, $fileName]); } } diff --git a/src/Extensions/FileSubsites.php b/src/Extensions/FileSubsites.php index 39a7a96..7837182 100644 --- a/src/Extensions/FileSubsites.php +++ b/src/Extensions/FileSubsites.php @@ -56,10 +56,7 @@ class FileSubsites extends DataExtension return; } - // If you're querying by ID, ignore the sub-site - this is a bit ugly... (but it was WAYYYYYYYYY worse) - // @TODO I don't think excluding if SiteTree_ImageTracking is a good idea however because of the SS 3.0 api and - // ManyManyList::removeAll() changing the from table after this function is called there isn't much of a choice - + // If you're querying by ID, ignore the sub-site $from = $query->getFrom(); if (isset($from['SiteTree_ImageTracking']) || $query->filtersOnID()) { return; diff --git a/src/Extensions/SiteTreeSubsites.php b/src/Extensions/SiteTreeSubsites.php index 5e4ce00..760eba0 100644 --- a/src/Extensions/SiteTreeSubsites.php +++ b/src/Extensions/SiteTreeSubsites.php @@ -140,9 +140,6 @@ class SiteTreeSubsites extends DataExtension ); $copyAction->addExtraClass('btn btn-primary font-icon-save ml-3'); - - // @todo check if this needs re-implementation -// $copyAction->includeDefaultJS(false); } // replace readonly link prefix diff --git a/src/Forms/GridFieldSubsiteDetailFormItemRequest.php b/src/Forms/GridFieldSubsiteDetailFormItemRequest.php index f6775aa..f5591c1 100644 --- a/src/Forms/GridFieldSubsiteDetailFormItemRequest.php +++ b/src/Forms/GridFieldSubsiteDetailFormItemRequest.php @@ -18,10 +18,6 @@ class GridFieldSubsiteDetailFormItemRequest extends GridFieldDetailForm_ItemRequ * Builds an item edit form. The arguments to getCMSFields() are the popupController and * popupFormName, however this is an experimental API and may change. * - * @todo In the future, we will probably need to come up with a tigher object representing a partially - * complete controller with gaps for extra functionality. This, for example, would be a better way - * of letting Security/login put its log-in form inside a UI specified elsewhere. - * * @return Form * @see GridFieldDetailForm_ItemRequest::ItemEditForm() */ diff --git a/src/Model/Subsite.php b/src/Model/Subsite.php index d32b0b4..a88e786 100644 --- a/src/Model/Subsite.php +++ b/src/Model/Subsite.php @@ -583,7 +583,6 @@ class Subsite extends DataObject * If more than one permission is passed to the method, at least one of them must * be granted for if to return TRUE. * - * @todo Allow permission inheritance through group hierarchy. * * @param Member Member to check against. Defaults to currently logged in member * @param array $permissionCodes @@ -641,7 +640,6 @@ class Subsite extends DataObject } /** - * @todo Possible security issue, don't grant edit permissions to everybody. * @param bool $member * @return bool */ diff --git a/src/Model/SubsiteDomain.php b/src/Model/SubsiteDomain.php index 2d93891..843f3db 100644 --- a/src/Model/SubsiteDomain.php +++ b/src/Model/SubsiteDomain.php @@ -180,8 +180,6 @@ class SubsiteDomain extends DataObject /** * Retrieves domain name with wildcards substituted with actual values * - * @todo Refactor domains into separate wildcards / primary domains - * * @return string */ public function getSubstitutedDomain() @@ -193,7 +191,6 @@ class SubsiteDomain extends DataObject $domain = preg_replace('/\.\*$/', ".{$currentHost}", $this->Domain ?? ''); // Default to "subsite." prefix for first wildcard - // TODO Whats the significance of "subsite" in this context?! $domain = preg_replace('/^\*\./', "subsite.", $domain ?? ''); // *Only* removes "intermediate" subdomains, so 'subdomain.www.domain.com' becomes 'subdomain.domain.com' diff --git a/tests/php/SiteTreeSubsitesTest.php b/tests/php/SiteTreeSubsitesTest.php index 20f36a8..fe2747b 100644 --- a/tests/php/SiteTreeSubsitesTest.php +++ b/tests/php/SiteTreeSubsitesTest.php @@ -138,7 +138,6 @@ class SiteTreeSubsitesTest extends BaseSubsiteTest 'Administrators can edit all subsites' ); - // @todo: Workaround because GroupSubsites->augmentSQL() is relying on session state Subsite::changeSubsite($subsite1); $this->logInAs($subsite1member->ID); @@ -153,7 +152,6 @@ class SiteTreeSubsitesTest extends BaseSubsiteTest 'Members cant edit pages on a subsite if they are not in a group belonging to this subsite' ); - // @todo: Workaround because GroupSubsites->augmentSQL() is relying on session state Subsite::changeSubsite(0); $this->assertFalse( $mainpage->canEdit(), From dd3073f41aa0d3d724ade8c3630ebd14eaefdad3 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 6 Nov 2023 16:29:35 +1300 Subject: [PATCH 4/4] TLN Update translations --- lang/fr.yml | 1 + lang/nl.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/lang/fr.yml b/lang/fr.yml index a8ebd03..a0862cc 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -1,5 +1,6 @@ fr: SilverStripe\Subsites\Model\Subsite: + ConfigurationTab: Configuration CustomExtraMeta: 'Balises Méta personnalisées' CustomMetaDescription: Description CustomMetaTitle: Titre diff --git a/lang/nl.yml b/lang/nl.yml index 03eda2c..c38fc63 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -21,6 +21,7 @@ nl: MANAGE_SUBSITES: 'Beheer subsites voor groepen' MANAGE_SUBSITES_HELP: 'Bepaal de toegangsrechten voor groepen per subsite' SECURITYTABTITLE: Subsites + db_AccessAllSubsites: 'Toegang tot alle subsites' many_many_Subsites: Subsites SilverStripe\Subsites\Extensions\LeftAndMainSubsites: SITECONTENTLEFT: 'Site inhoud'