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..dc66b94 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -1,8 +1,9 @@ --- Name: todoextension -After: 'framework/*','cms/*' +After: + - 'framework/*' --- -SiteTree: +SilverStripe\CMS\Model\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..845e79b 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 4.0", + "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..332ec4c --- /dev/null +++ b/src/Report.php @@ -0,0 +1,42 @@ + \'\'', '"SiteTree"."LastEdited" DESC'); + } + + function columns() { + return array( + 'Title' => array( + 'title' => 'Title', // todo: use NestedTitle(2) + 'link' => true, + ), + 'ToDo' => array( + 'title' => 'ToDo', + 'newline' => true, + ), + ); + } +}