From 8df75dbc72891222a7bb104981dd967cc2d66030 Mon Sep 17 00:00:00 2001 From: Lee Bradley Date: Fri, 17 Feb 2017 12:39:31 +0000 Subject: [PATCH 1/4] Start migration to SS4 --- README.md | 4 +-- _config/config.yml | 2 +- code/SideReportTodo.php | 31 -------------------- code/SiteTreePageTodoExtension.php | 21 -------------- composer.json | 45 +++++++++++++++++------------- src/Extension.php | 30 ++++++++++++++++++++ src/Report.php | 41 +++++++++++++++++++++++++++ 7 files changed, 99 insertions(+), 75 deletions(-) delete mode 100644 code/SideReportTodo.php delete mode 100644 code/SiteTreePageTodoExtension.php create mode 100644 src/Extension.php create mode 100644 src/Report.php diff --git a/README.md b/README.md index d61adbf..5453492 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ To finish a todo entry, simply remove the line of text from the textbox. ## Requirements ## - * SilverStripe 3.1 or newer + * SilverStripe 4 or newer ## Maintainers ## - * Ingo Schommer (ingo at silverstripe dot com) \ No newline at end of file + * Ingo Schommer (ingo at silverstripe dot com) diff --git a/_config/config.yml b/_config/config.yml index 6ecd788..aeb34a1 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -5,4 +5,4 @@ After: 'framework/*','cms/*' SiteTree: extensions: - - SiteTreePageTodoExtension \ No newline at end of file + - Silverstripe\ToDo\Extension diff --git a/code/SideReportTodo.php b/code/SideReportTodo.php deleted file mode 100644 index 4e70361..0000000 --- a/code/SideReportTodo.php +++ /dev/null @@ -1,31 +0,0 @@ - ''", "\"SiteTree\".\"LastEdited\" DESC"); - } - function columns() { - return array( - "Title" => array( - "title" => "Title", // todo: use NestedTitle(2) - "link" => true, - ), - "ToDo" => array( - "title" => "ToDo", - "newline" => true, - ), - ); - } -} \ No newline at end of file diff --git a/code/SiteTreePageTodoExtension.php b/code/SiteTreePageTodoExtension.php deleted file mode 100644 index 8a008c4..0000000 --- a/code/SiteTreePageTodoExtension.php +++ /dev/null @@ -1,21 +0,0 @@ - "Text" - ); - - function updateCMSFields(FieldList $fields) { - if (!$fields->hasField('ToDo')) { - $fields->addFieldToTab('Root', new Tab(_t('SiteTree.TABTODO', 'To-do') . ($this->owner->ToDo ? '**' : ''), - new LiteralField("ToDoHelp", _t('SiteTree.TODOHELP', "

You can use this to keep track of work that needs to be done to the content of your site. To see all your pages with to do information, open the 'Site Reports' window on the left and select 'To Do'

")), - new TextareaField("ToDo", "", 10) - )); - } - } - - function updateFieldLabels(&$labels) { - $labels['ToDo'] = _t('SiteTree.ToDo', 'Todo Notes'); - } -} \ No newline at end of file diff --git a/composer.json b/composer.json index 47c5bd6..4aff0da 100644 --- a/composer.json +++ b/composer.json @@ -1,28 +1,33 @@ { - "name": "silverstripe-labs/silverstripe-page-todo", - "description": "Fork of old todo code used in Silverstripe 2.4 updated for 3.1", - "type": "silverstripe-module", - "keywords": ["silverstripe", "extension"], - "license": "BSD-3-Clause", - "authors": [ + "name": "silverstripe-labs/silverstripe-page-todo", + "description": "Fork of old todo code used in Silverstripe 2.4 updated for 3.1", + "type": "silverstripe-module", + "keywords": ["silverstripe", "extension"], + "license": "BSD-3-Clause", + "authors": [ { "name": "Ingo Schommer", "email": "ingo@silverstripe.com", "homepage": "http://www.silverstripe.com", "role": "Maintainer" } - ], - "support": { - "issues": "https://github.com/silverstripe-labs/silverstripe-page-todo/issues" - }, - "require": { - "silverstripe/framework": "3.*", - "silverstripe/cms": "3.*", - "composer/installers": "*" - }, - "suggest": { - }, - "extra": { - "installer-name": "todo" - } + ], + "support": { + "issues": "https://github.com/silverstripe-labs/silverstripe-page-todo/issues" + }, + "require": { + "silverstripe/framework": "^4.0@dev", + "silverstripe/cms": "^4.0@dev", + "composer/installers": "*" + }, + "autoload": { + "psr-4": { + "Silverstripe\\ToDo\\": "src/" + } + }, + "suggest": { + }, + "extra": { + "installer-name": "todo" + } } diff --git a/src/Extension.php b/src/Extension.php new file mode 100644 index 0000000..2beab56 --- /dev/null +++ b/src/Extension.php @@ -0,0 +1,30 @@ + 'Text' + ); + + function updateCMSFields(FieldList $fields) { + if (!$fields->hasField('ToDo')) { + $fields->addFieldToTab('Root', new Tab(_t('SiteTree.TABTODO', 'To-do') . ($this->owner->ToDo ? '**' : ''), + new LiteralField('ToDoHelp', _t('SiteTree.TODOHELP', '

You can use this to keep track of work that needs to be done to the content of your site. To see all your pages with to do information, open the \'Site Reports\' window on the left and select \'To Do\'

')), + new TextareaField('ToDo', '', 10) + )); + } + } + + function updateFieldLabels(&$labels) { + $labels['ToDo'] = _t('SiteTree.ToDo', 'Todo Notes'); + } +} diff --git a/src/Report.php b/src/Report.php new file mode 100644 index 0000000..4d98e21 --- /dev/null +++ b/src/Report.php @@ -0,0 +1,41 @@ + \'\'', '"SiteTree"."LastEdited" DESC'); + } + + function columns() { + return array( + 'Title' => array( + 'title' => 'Title', // todo: use NestedTitle(2) + 'link' => true, + ), + 'ToDo' => array( + 'title' => 'ToDo', + 'newline' => true, + ), + ); + } +} From 6a49a0662c60a3ba197acb0f7010ddafe5f6ebf7 Mon Sep 17 00:00:00 2001 From: Lee Bradley Date: Fri, 17 Feb 2017 12:48:28 +0000 Subject: [PATCH 2/4] Amend for SS4 migration where was missing `use` cases --- _config/config.yml | 6 ++++-- src/Report.php | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/_config/config.yml b/_config/config.yml index aeb34a1..f276e93 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -1,8 +1,10 @@ --- Name: todoextension -After: 'framework/*','cms/*' +After: + - 'framework/*' + - 'cms/*' --- -SiteTree: +SilverStripe\CMS\Model\SiteTree: extensions: - Silverstripe\ToDo\Extension diff --git a/src/Report.php b/src/Report.php index 4d98e21..332ec4c 100644 --- a/src/Report.php +++ b/src/Report.php @@ -3,6 +3,7 @@ namespace Silverstripe\ToDo; use SilverStripe\Reports\Report as Base_Report; +use SilverStripe\ORM\DataObject; /** * @package cms @@ -23,7 +24,7 @@ function sort() { } function sourceRecords($params = null) { - return DataObject::get('SiteTree', '"SiteTree"."ToDo" IS NOT NULL AND "SiteTree"."ToDo" <> \'\'', '"SiteTree"."LastEdited" DESC'); + return DataObject::get('SilverStripe\CMS\Model\SiteTree', '"SiteTree"."ToDo" IS NOT NULL AND "SiteTree"."ToDo" <> \'\'', '"SiteTree"."LastEdited" DESC'); } function columns() { From 375cea1a7670489ee6ec6e6b992103ead76df53b Mon Sep 17 00:00:00 2001 From: Lee Bradley Date: Fri, 17 Feb 2017 12:55:16 +0000 Subject: [PATCH 3/4] Update to composer description --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4aff0da..845e79b 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "silverstripe-labs/silverstripe-page-todo", - "description": "Fork of old todo code used in Silverstripe 2.4 updated for 3.1", + "description": "Fork of old todo code used in Silverstripe 2.4 updated for 4.0", "type": "silverstripe-module", "keywords": ["silverstripe", "extension"], "license": "BSD-3-Clause", From d5a872d89d4f3e9e3f500e874c47f658375be01b Mon Sep 17 00:00:00 2001 From: Lee Bradley Date: Thu, 2 Mar 2017 11:40:41 +0000 Subject: [PATCH 4/4] Update to comfig.yml to remove "Before" for 'cms/*' Was causing circular dependency --- _config/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/_config/config.yml b/_config/config.yml index f276e93..dc66b94 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -2,7 +2,6 @@ Name: todoextension After: - 'framework/*' - - 'cms/*' --- SilverStripe\CMS\Model\SiteTree: