Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SS4 Migration #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
* Ingo Schommer (ingo at silverstripe dot com)
7 changes: 4 additions & 3 deletions _config/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
Name: todoextension
After: 'framework/*','cms/*'
After:
- 'framework/*'
---

SiteTree:
SilverStripe\CMS\Model\SiteTree:
extensions:
- SiteTreePageTodoExtension
- Silverstripe\ToDo\Extension
31 changes: 0 additions & 31 deletions code/SideReportTodo.php

This file was deleted.

21 changes: 0 additions & 21 deletions code/SiteTreePageTodoExtension.php

This file was deleted.

45 changes: 25 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]",
"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"
}
}
30 changes: 30 additions & 0 deletions src/Extension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Silverstripe\ToDo;

use SilverStripe\ORM\DataExtension;

use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\Tab;
use SilverStripe\Forms\TextareaField;

class Extension extends DataExtension
{
private static $db = array(
'ToDo' => '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', '<p>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\'</p>')),
new TextareaField('ToDo', '', 10)
));
}
}

function updateFieldLabels(&$labels) {
$labels['ToDo'] = _t('SiteTree.ToDo', 'Todo Notes');
}
}
42 changes: 42 additions & 0 deletions src/Report.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Silverstripe\ToDo;

use SilverStripe\Reports\Report as Base_Report;
use SilverStripe\ORM\DataObject;

/**
* @package cms
* @subpackage content
*/
class Report extends Base_Report
{
function title() {
return _t('SideReport.TODO','Pages with To Do items');
}

function group() {
return _t('SideReport.ContentGroupTitle', 'Content reports');
}

function sort() {
return 0;
}

function sourceRecords($params = null) {
return DataObject::get('SilverStripe\CMS\Model\SiteTree', '"SiteTree"."ToDo" IS NOT NULL AND "SiteTree"."ToDo" <> \'\'', '"SiteTree"."LastEdited" DESC');
}

function columns() {
return array(
'Title' => array(
'title' => 'Title', // todo: use NestedTitle(2)
'link' => true,
),
'ToDo' => array(
'title' => 'ToDo',
'newline' => true,
),
);
}
}