mirror of
https://github.com/silverstripe/silverstripe-contentreview
synced 2024-10-22 17:05:47 +02:00
ENHANCEMENT Optimise imports, upgrade array syntax
This commit is contained in:
parent
fe44baaa98
commit
ad2932c418
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -4,3 +4,5 @@
|
|||||||
/.gitignore export-ignore
|
/.gitignore export-ignore
|
||||||
/.travis.yml export-ignore
|
/.travis.yml export-ignore
|
||||||
/.scrutinizer.yml export-ignore
|
/.scrutinizer.yml export-ignore
|
||||||
|
/.phpcs.xml.dist export-ignore
|
||||||
|
/.codecov.yml export-ignore
|
||||||
|
@ -43,7 +43,7 @@ before_script:
|
|||||||
script:
|
script:
|
||||||
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
|
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
|
||||||
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
|
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
|
||||||
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs --standard=vendor/silverstripe/framework/phpcs.xml.dist src/ tests/; fi
|
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/; fi
|
||||||
- if [[ $BEHAT_TEST ]]; then vendor/bin/behat @contentreview; fi
|
- if [[ $BEHAT_TEST ]]; then vendor/bin/behat @contentreview; fi
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
|
35
changelog.md
35
changelog.md
@ -1,35 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
|
||||||
|
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
||||||
|
|
||||||
## [3.0.2]
|
|
||||||
|
|
||||||
* fix(ContentReviewNotificationJob): Changed to use ->config() system so that the next_run_hour can be configured in YAML.
|
|
||||||
* BUG Prevent non-real draft changes forcing record to appear as changed when saved
|
|
||||||
|
|
||||||
## [3.0.1]
|
|
||||||
|
|
||||||
- Update documentation and configuration to supported module standard
|
|
||||||
- Fix documentation links
|
|
||||||
|
|
||||||
## [3.0.0]
|
|
||||||
|
|
||||||
- Replace review page form with inline form
|
|
||||||
- Update translations
|
|
||||||
- Convert to psr-2
|
|
||||||
- Change "mark as reviewed" page action panel styles
|
|
||||||
- Add report filter for only the pages a user is assigned to
|
|
||||||
- BUG Show inherited date even when inheriting settings
|
|
||||||
- API CMS Editable notification templates
|
|
||||||
|
|
||||||
## [2.1.0]
|
|
||||||
|
|
||||||
- Added translations
|
|
||||||
- Fixed a saving bug
|
|
||||||
- Renamed "reviewed" button
|
|
||||||
|
|
||||||
## [2.0.0]
|
|
||||||
|
|
||||||
Changelog added.
|
|
10
phpcs.xml.dist
Normal file
10
phpcs.xml.dist
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ruleset name="SilverStripe">
|
||||||
|
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>
|
||||||
|
|
||||||
|
<rule ref="PSR2" >
|
||||||
|
<!-- Current exclusions -->
|
||||||
|
<exclude name="PSR1.Methods.CamelCapsMethodName" />
|
||||||
|
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
|
||||||
|
</rule>
|
||||||
|
</ruleset>
|
@ -3,8 +3,6 @@
|
|||||||
[![Build status](https://travis-ci.org/silverstripe/silverstripe-contentreview.png?branch=master)](https://travis-ci.org/silverstripe/silverstripe-contentreview)
|
[![Build status](https://travis-ci.org/silverstripe/silverstripe-contentreview.png?branch=master)](https://travis-ci.org/silverstripe/silverstripe-contentreview)
|
||||||
[![Code quality](https://scrutinizer-ci.com/g/silverstripe/silverstripe-contentreview/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-contentreview/?branch=master)
|
[![Code quality](https://scrutinizer-ci.com/g/silverstripe/silverstripe-contentreview/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-contentreview/?branch=master)
|
||||||
[![Code coverage](https://codecov.io/gh/silverstripe/silverstripe-contentreview/branch/master/graph/badge.svg)](https://codecov.io/gh/silverstripe/silverstripe-contentreview)
|
[![Code coverage](https://codecov.io/gh/silverstripe/silverstripe-contentreview/branch/master/graph/badge.svg)](https://codecov.io/gh/silverstripe/silverstripe-contentreview)
|
||||||
[![Version](http://img.shields.io/packagist/v/silverstripe/contentreview.svg)](https://packagist.org/packages/silverstripe/contentreview)
|
|
||||||
[![License](http://img.shields.io/packagist/l/silverstripe/contentreview.svg)](license.md)
|
|
||||||
|
|
||||||
This module helps keep your website content accurate and up-to-date, which keeps your users happy.
|
This module helps keep your website content accurate and up-to-date, which keeps your users happy.
|
||||||
|
|
||||||
@ -20,6 +18,8 @@ There are two types of roles with this module.
|
|||||||
|
|
||||||
* SilverStripe ^4.0
|
* SilverStripe ^4.0
|
||||||
|
|
||||||
|
**Note:** For SilverStripe 3.x, please use the [3.x release line](https://github.com/silverstripe/silverstripe-contentreview/tree/3).
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* Content reviewer will receive an email notification when a page is due for review.
|
* Content reviewer will receive an email notification when a page is due for review.
|
||||||
|
@ -4,9 +4,10 @@ namespace SilverStripe\ContentReview\Compatibility;
|
|||||||
|
|
||||||
use SilverStripe\Core\ClassInfo;
|
use SilverStripe\Core\ClassInfo;
|
||||||
use SilverStripe\Subsites\Model\Subsite;
|
use SilverStripe\Subsites\Model\Subsite;
|
||||||
// @todo add translatable namespace
|
|
||||||
use Translatable;
|
use Translatable;
|
||||||
|
|
||||||
|
// @todo add translatable namespace
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a helper class which lets us do things with content review data without subsites
|
* This is a helper class which lets us do things with content review data without subsites
|
||||||
* and translatable messing our SQL queries up.
|
* and translatable messing our SQL queries up.
|
||||||
@ -27,10 +28,10 @@ class ContentReviewCompatability
|
|||||||
*/
|
*/
|
||||||
public static function start()
|
public static function start()
|
||||||
{
|
{
|
||||||
$compatibility = array(
|
$compatibility = [
|
||||||
self::SUBSITES => null,
|
self::SUBSITES => null,
|
||||||
self::TRANSLATABLE => null,
|
self::TRANSLATABLE => null,
|
||||||
);
|
];
|
||||||
|
|
||||||
if (ClassInfo::exists(Subsite::class)) {
|
if (ClassInfo::exists(Subsite::class)) {
|
||||||
$compatibility[self::SUBSITES] = Subsite::$disable_subsite_filter;
|
$compatibility[self::SUBSITES] = Subsite::$disable_subsite_filter;
|
||||||
|
@ -42,7 +42,8 @@ class ContentReviewDefaultSettings extends DataExtension
|
|||||||
*/
|
*/
|
||||||
private static $defaults = array(
|
private static $defaults = array(
|
||||||
'ReviewSubject' => 'Page(s) are due for content review',
|
'ReviewSubject' => 'Page(s) are due for content review',
|
||||||
'ReviewBody' => '<h2>Page(s) due for review</h2><p>There are $PagesCount pages that are due for review today by you.</p>',
|
'ReviewBody' => '<h2>Page(s) due for review</h2>'
|
||||||
|
. '<p>There are $PagesCount pages that are due for review today by you.</p>',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,10 +51,10 @@ class ContentReviewDefaultSettings extends DataExtension
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $many_many = array(
|
private static $many_many = [
|
||||||
'ContentReviewGroups' => Group::class,
|
'ContentReviewGroups' => Group::class,
|
||||||
'ContentReviewUsers' => Member::class,
|
'ContentReviewUsers' => Member::class,
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Template to use for content review emails.
|
* Template to use for content review emails.
|
||||||
@ -71,7 +72,7 @@ class ContentReviewDefaultSettings extends DataExtension
|
|||||||
*/
|
*/
|
||||||
public function getOwnerNames()
|
public function getOwnerNames()
|
||||||
{
|
{
|
||||||
$names = array();
|
$names = [];
|
||||||
|
|
||||||
foreach ($this->OwnerGroups() as $group) {
|
foreach ($this->OwnerGroups() as $group) {
|
||||||
$names[] = $group->getBreadcrumbs(' > ');
|
$names[] = $group->getBreadcrumbs(' > ');
|
||||||
@ -127,10 +128,10 @@ class ContentReviewDefaultSettings extends DataExtension
|
|||||||
|
|
||||||
$fields->addFieldToTab('Root.ContentReview', $reviewFrequency);
|
$fields->addFieldToTab('Root.ContentReview', $reviewFrequency);
|
||||||
|
|
||||||
$users = Permission::get_members_by_permission(array(
|
$users = Permission::get_members_by_permission([
|
||||||
'CMS_ACCESS_CMSMain',
|
'CMS_ACCESS_CMSMain',
|
||||||
'ADMIN',
|
'ADMIN',
|
||||||
));
|
]);
|
||||||
|
|
||||||
$usersMap = $users->map('ID', 'Title')->toArray();
|
$usersMap = $users->map('ID', 'Title')->toArray();
|
||||||
asort($usersMap);
|
asort($usersMap);
|
||||||
@ -141,7 +142,7 @@ class ContentReviewDefaultSettings extends DataExtension
|
|||||||
|
|
||||||
$fields->addFieldToTab('Root.ContentReview', $userField);
|
$fields->addFieldToTab('Root.ContentReview', $userField);
|
||||||
|
|
||||||
$groupsMap = array();
|
$groupsMap = [];
|
||||||
|
|
||||||
foreach (Group::get() as $group) {
|
foreach (Group::get() as $group) {
|
||||||
// Listboxfield values are escaped, use ASCII char instead of »
|
// Listboxfield values are escaped, use ASCII char instead of »
|
||||||
@ -159,7 +160,7 @@ class ContentReviewDefaultSettings extends DataExtension
|
|||||||
// Email content
|
// Email content
|
||||||
$fields->addFieldsToTab(
|
$fields->addFieldsToTab(
|
||||||
'Root.ContentReview',
|
'Root.ContentReview',
|
||||||
array(
|
[
|
||||||
TextField::create('ReviewFrom', _t(__CLASS__ . '.EMAILFROM', 'From email address'))
|
TextField::create('ReviewFrom', _t(__CLASS__ . '.EMAILFROM', 'From email address'))
|
||||||
->setDescription(_t(__CLASS__ . '.EMAILFROM_RIGHTTITLE', 'e.g: do-not-reply@site.com')),
|
->setDescription(_t(__CLASS__ . '.EMAILFROM_RIGHTTITLE', 'e.g: do-not-reply@site.com')),
|
||||||
TextField::create('ReviewSubject', _t(__CLASS__ . '.EMAILSUBJECT', 'Subject line')),
|
TextField::create('ReviewSubject', _t(__CLASS__ . '.EMAILSUBJECT', 'Subject line')),
|
||||||
@ -168,7 +169,7 @@ class ContentReviewDefaultSettings extends DataExtension
|
|||||||
'TemplateHelp',
|
'TemplateHelp',
|
||||||
$this->owner->renderWith('SilverStripe\\ContentReview\\ContentReviewAdminHelp')
|
$this->owner->renderWith('SilverStripe\\ContentReview\\ContentReviewAdminHelp')
|
||||||
),
|
),
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ class ContentReviewOwner extends DataExtension
|
|||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $many_many = array(
|
private static $many_many = [
|
||||||
"SiteTreeContentReview" => SiteTree::class,
|
"SiteTreeContentReview" => SiteTree::class,
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
@ -62,40 +62,40 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $db = array(
|
private static $db = [
|
||||||
"ContentReviewType" => "Enum('Inherit, Disabled, Custom', 'Inherit')",
|
"ContentReviewType" => "Enum('Inherit, Disabled, Custom', 'Inherit')",
|
||||||
"ReviewPeriodDays" => "Int",
|
"ReviewPeriodDays" => "Int",
|
||||||
"NextReviewDate" => "Date",
|
"NextReviewDate" => "Date",
|
||||||
"LastEditedByName" => "Varchar(255)",
|
"LastEditedByName" => "Varchar(255)",
|
||||||
"OwnerNames" => "Varchar(255)",
|
"OwnerNames" => "Varchar(255)",
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $defaults = array(
|
private static $defaults = [
|
||||||
"ContentReviewType" => "Inherit",
|
"ContentReviewType" => "Inherit",
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $has_many = array(
|
private static $has_many = [
|
||||||
"ReviewLogs" => ContentReviewLog::class,
|
"ReviewLogs" => ContentReviewLog::class,
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $belongs_many_many = array(
|
private static $belongs_many_many = [
|
||||||
"ContentReviewGroups" => Group::class,
|
"ContentReviewGroups" => Group::class,
|
||||||
"ContentReviewUsers" => Member::class,
|
"ContentReviewUsers" => Member::class,
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $schedule = array(
|
private static $schedule = [
|
||||||
0 => "No automatic review date",
|
0 => "No automatic review date",
|
||||||
1 => "1 day",
|
1 => "1 day",
|
||||||
7 => "1 week",
|
7 => "1 week",
|
||||||
@ -106,7 +106,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
152 => "5 months",
|
152 => "5 months",
|
||||||
183 => "6 months",
|
183 => "6 months",
|
||||||
365 => "12 months",
|
365 => "12 months",
|
||||||
);
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
@ -129,7 +129,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
$contentReviewOwners = new ArrayList();
|
$contentReviewOwners = new ArrayList();
|
||||||
|
|
||||||
if ($groups->count()) {
|
if ($groups->count()) {
|
||||||
$groupIDs = array();
|
$groupIDs = [];
|
||||||
|
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
$familyIDs = $group->collateFamilyIDs();
|
$familyIDs = $group->collateFamilyIDs();
|
||||||
@ -142,7 +142,8 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
array_unique($groupIDs);
|
array_unique($groupIDs);
|
||||||
|
|
||||||
if (count($groupIDs)) {
|
if (count($groupIDs)) {
|
||||||
$groupMembers = DataObject::get(Member::class)->where("\"Group\".\"ID\" IN (" . implode(",", $groupIDs) . ")")
|
$groupMembers = DataObject::get(Member::class)
|
||||||
|
->where("\"Group\".\"ID\" IN (" . implode(",", $groupIDs) . ")")
|
||||||
->leftJoin("Group_Members", "\"Member\".\"ID\" = \"Group_Members\".\"MemberID\"")
|
->leftJoin("Group_Members", "\"Member\".\"ID\" = \"Group_Members\".\"MemberID\"")
|
||||||
/** @skipUpgrade */
|
/** @skipUpgrade */
|
||||||
->leftJoin('Group', "\"Group_Members\".\"GroupID\" = \"Group\".\"ID\"");
|
->leftJoin('Group', "\"Group_Members\".\"GroupID\" = \"Group\".\"ID\"");
|
||||||
@ -178,7 +179,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
*
|
*
|
||||||
* @param SiteTree $page
|
* @param SiteTree $page
|
||||||
*
|
*
|
||||||
* @return bool|Date
|
* @return bool|DBDate
|
||||||
*/
|
*/
|
||||||
public function getReviewDate(SiteTree $page = null)
|
public function getReviewDate(SiteTree $page = null)
|
||||||
{
|
{
|
||||||
@ -204,7 +205,6 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
$nextReviewUnixSec = strtotime(' + ' . $options->ReviewPeriodDays . ' days', DBDatetime::now()->getTimestamp());
|
$nextReviewUnixSec = strtotime(' + ' . $options->ReviewPeriodDays . ' days', DBDatetime::now()->getTimestamp());
|
||||||
$date = DBDate::create('NextReviewDate');
|
$date = DBDate::create('NextReviewDate');
|
||||||
$date->setValue($nextReviewUnixSec);
|
$date->setValue($nextReviewUnixSec);
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
{
|
{
|
||||||
$options = $this->getOptions();
|
$options = $this->getOptions();
|
||||||
|
|
||||||
$names = array();
|
$names = [];
|
||||||
|
|
||||||
if (!$options) {
|
if (!$options) {
|
||||||
return "";
|
return "";
|
||||||
@ -333,18 +333,34 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
$module = ModuleLoader::getModule('silverstripe/contentreview');
|
$module = ModuleLoader::getModule('silverstripe/contentreview');
|
||||||
Requirements::javascript($module->getRelativeResourcePath('client/dist/js/contentreview.js'));
|
Requirements::javascript($module->getResource('client/dist/js/contentreview.js')->getRelativePath());
|
||||||
|
|
||||||
// Display read-only version only
|
// Display read-only version only
|
||||||
if (!Permission::check("EDIT_CONTENT_REVIEW_FIELDS")) {
|
if (!Permission::check("EDIT_CONTENT_REVIEW_FIELDS")) {
|
||||||
$schedule = self::get_schedule();
|
$schedule = self::get_schedule();
|
||||||
$contentOwners = ReadonlyField::create("ROContentOwners", _t(__CLASS__ . ".CONTENTOWNERS", "Content Owners"), $this->getOwnerNames());
|
$contentOwners = ReadonlyField::create(
|
||||||
$nextReviewAt = DateField::create('RONextReviewDate', _t(__CLASS__ . ".NEXTREVIEWDATE", "Next review date"), $this->owner->NextReviewDate);
|
"ROContentOwners",
|
||||||
|
_t(__CLASS__ . ".CONTENTOWNERS", "Content Owners"),
|
||||||
|
$this->getOwnerNames()
|
||||||
|
);
|
||||||
|
$nextReviewAt = DateField::create(
|
||||||
|
'RONextReviewDate',
|
||||||
|
_t(__CLASS__ . ".NEXTREVIEWDATE", "Next review date"),
|
||||||
|
$this->owner->NextReviewDate
|
||||||
|
);
|
||||||
|
|
||||||
if (!isset($schedule[$this->owner->ReviewPeriodDays])) {
|
if (!isset($schedule[$this->owner->ReviewPeriodDays])) {
|
||||||
$reviewFreq = ReadonlyField::create("ROReviewPeriodDays", _t(__CLASS__ . ".REVIEWFREQUENCY", "Review frequency"), $schedule[0]);
|
$reviewFreq = ReadonlyField::create(
|
||||||
|
"ROReviewPeriodDays",
|
||||||
|
_t(__CLASS__ . ".REVIEWFREQUENCY", "Review frequency"),
|
||||||
|
$schedule[0]
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$reviewFreq = ReadonlyField::create("ROReviewPeriodDays", _t(__CLASS__ . ".REVIEWFREQUENCY", "Review frequency"), $schedule[$this->owner->ReviewPeriodDays]);
|
$reviewFreq = ReadonlyField::create(
|
||||||
|
"ROReviewPeriodDays",
|
||||||
|
_t(__CLASS__ . ".REVIEWFREQUENCY", "Review frequency"),
|
||||||
|
$schedule[$this->owner->ReviewPeriodDays]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$logConfig = GridFieldConfig::create()
|
$logConfig = GridFieldConfig::create()
|
||||||
@ -352,34 +368,41 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
->addComponent($logColumns = Injector::inst()->create(GridFieldDataColumns::class));
|
->addComponent($logColumns = Injector::inst()->create(GridFieldDataColumns::class));
|
||||||
|
|
||||||
// Cast the value to the users preferred date format
|
// Cast the value to the users preferred date format
|
||||||
$logColumns->setFieldCasting(array(
|
$logColumns->setFieldCasting([
|
||||||
'Created' => DateTimeField::class . '->value',
|
'Created' => DateTimeField::class . '->value',
|
||||||
));
|
]);
|
||||||
|
|
||||||
$logs = GridField::create("ROReviewNotes", "Review Notes", $this->owner->ReviewLogs(), $logConfig);
|
$logs = GridField::create("ROReviewNotes", "Review Notes", $this->owner->ReviewLogs(), $logConfig);
|
||||||
|
|
||||||
|
$optionsFrom = ReadonlyField::create(
|
||||||
|
"ROType",
|
||||||
|
_t(__CLASS__ . ".SETTINGSFROM", "Options are"),
|
||||||
|
$this->owner->ContentReviewType
|
||||||
|
);
|
||||||
|
|
||||||
$optionsFrom = ReadonlyField::create("ROType", _t(__CLASS__ . ".SETTINGSFROM", "Options are"), $this->owner->ContentReviewType);
|
$fields->addFieldsToTab("Root.ContentReview", [
|
||||||
|
|
||||||
$fields->addFieldsToTab("Root.ContentReview", array(
|
|
||||||
$contentOwners,
|
$contentOwners,
|
||||||
$nextReviewAt->performReadonlyTransformation(),
|
$nextReviewAt->performReadonlyTransformation(),
|
||||||
$reviewFreq,
|
$reviewFreq,
|
||||||
$optionsFrom,
|
$optionsFrom,
|
||||||
$logs,
|
$logs,
|
||||||
));
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = array();
|
$options = [];
|
||||||
$options["Disabled"] = _t(__CLASS__ . ".DISABLE", "Disable content review");
|
$options["Disabled"] = _t(__CLASS__ . ".DISABLE", "Disable content review");
|
||||||
$options["Inherit"] = _t(__CLASS__ . ".INHERIT", "Inherit from parent page");
|
$options["Inherit"] = _t(__CLASS__ . ".INHERIT", "Inherit from parent page");
|
||||||
$options["Custom"] = _t(__CLASS__ . ".CUSTOM", "Custom settings");
|
$options["Custom"] = _t(__CLASS__ . ".CUSTOM", "Custom settings");
|
||||||
|
|
||||||
$viewersOptionsField = OptionsetField::create("ContentReviewType", _t(__CLASS__ . ".OPTIONS", "Options"), $options);
|
$viewersOptionsField = OptionsetField::create(
|
||||||
|
"ContentReviewType",
|
||||||
|
_t(__CLASS__ . ".OPTIONS", "Options"),
|
||||||
|
$options
|
||||||
|
);
|
||||||
|
|
||||||
$users = Permission::get_members_by_permission(array("CMS_ACCESS_CMSMain", "ADMIN"));
|
$users = Permission::get_members_by_permission(["CMS_ACCESS_CMSMain", "ADMIN"]);
|
||||||
|
|
||||||
$usersMap = $users->map("ID", "Title")->toArray();
|
$usersMap = $users->map("ID", "Title")->toArray();
|
||||||
|
|
||||||
@ -390,7 +413,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
->setAttribute("data-placeholder", _t(__CLASS__ . ".ADDUSERS", "Add users"))
|
->setAttribute("data-placeholder", _t(__CLASS__ . ".ADDUSERS", "Add users"))
|
||||||
->setDescription(_t(__CLASS__ . '.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews'));
|
->setDescription(_t(__CLASS__ . '.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews'));
|
||||||
|
|
||||||
$groupsMap = array();
|
$groupsMap = [];
|
||||||
|
|
||||||
foreach (Group::get() as $group) {
|
foreach (Group::get() as $group) {
|
||||||
$groupsMap[$group->ID] = $group->getBreadcrumbs(" > ");
|
$groupsMap[$group->ID] = $group->getBreadcrumbs(" > ");
|
||||||
@ -411,11 +434,19 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
self::get_schedule()
|
self::get_schedule()
|
||||||
)
|
)
|
||||||
->addExtraClass('custom-setting')
|
->addExtraClass('custom-setting')
|
||||||
->setDescription(_t(__CLASS__ . ".REVIEWFREQUENCYDESCRIPTION", "The review date will be set to this far in the future whenever the page is published"));
|
->setDescription(_t(
|
||||||
|
__CLASS__ . ".REVIEWFREQUENCYDESCRIPTION",
|
||||||
|
"The review date will be set to this far in the future whenever the page is published"
|
||||||
|
));
|
||||||
|
|
||||||
$notesField = GridField::create("ReviewNotes", "Review Notes", $this->owner->ReviewLogs(), GridFieldConfig_RecordEditor::create());
|
$notesField = GridField::create(
|
||||||
|
"ReviewNotes",
|
||||||
|
"Review Notes",
|
||||||
|
$this->owner->ReviewLogs(),
|
||||||
|
GridFieldConfig_RecordEditor::create()
|
||||||
|
);
|
||||||
|
|
||||||
$fields->addFieldsToTab("Root.ContentReview", array(
|
$fields->addFieldsToTab("Root.ContentReview", [
|
||||||
HeaderField::create('ContentReviewHeader', _t(__CLASS__ . ".REVIEWHEADER", "Content review"), 2),
|
HeaderField::create('ContentReviewHeader', _t(__CLASS__ . ".REVIEWHEADER", "Content review"), 2),
|
||||||
$viewersOptionsField,
|
$viewersOptionsField,
|
||||||
CompositeField::create(
|
CompositeField::create(
|
||||||
@ -424,9 +455,13 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
$reviewDate,
|
$reviewDate,
|
||||||
$reviewFrequency
|
$reviewFrequency
|
||||||
)->addExtraClass("review-settings"),
|
)->addExtraClass("review-settings"),
|
||||||
ReadonlyField::create("ROContentOwners", _t(__CLASS__ . ".CONTENTOWNERS", "Content Owners"), $this->getOwnerNames()),
|
ReadonlyField::create(
|
||||||
|
"ROContentOwners",
|
||||||
|
_t(__CLASS__ . ".CONTENTOWNERS", "Content Owners"),
|
||||||
|
$this->getOwnerNames()
|
||||||
|
),
|
||||||
$notesField,
|
$notesField,
|
||||||
));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -493,7 +528,8 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
|
|
||||||
if (!$options
|
if (!$options
|
||||||
// Options can be a SiteConfig with different extension applied
|
// Options can be a SiteConfig with different extension applied
|
||||||
|| (!$options->hasExtension(__CLASS__) && !$options->hasExtension(ContentReviewDefaultSettings::class))
|
|| (!$options->hasExtension(__CLASS__)
|
||||||
|
&& !$options->hasExtension(ContentReviewDefaultSettings::class))
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -615,13 +651,13 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
*/
|
*/
|
||||||
public function providePermissions()
|
public function providePermissions()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
"EDIT_CONTENT_REVIEW_FIELDS" => array(
|
"EDIT_CONTENT_REVIEW_FIELDS" => [
|
||||||
"name" => "Set content owners and review dates",
|
"name" => "Set content owners and review dates",
|
||||||
"category" => _t("SilverStripe\\Security\\Permission.CONTENT_CATEGORY", "Content permissions"),
|
"category" => _t("SilverStripe\\Security\\Permission.CONTENT_CATEGORY", "Content permissions"),
|
||||||
"sort" => 50,
|
"sort" => 50,
|
||||||
),
|
],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -638,7 +674,10 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
|
|
||||||
$nextRun = Injector::inst()->create(ContentReviewNotificationJob::class);
|
$nextRun = Injector::inst()->create(ContentReviewNotificationJob::class);
|
||||||
$runHour = Config::inst()->get(ContentReviewNotificationJob::class, "first_run_hour");
|
$runHour = Config::inst()->get(ContentReviewNotificationJob::class, "first_run_hour");
|
||||||
$firstRunTime = date("Y-m-d H:i:s", mktime($runHour, 0, 0, date("m"), date("d") + 1, date("y")));
|
$firstRunTime = date(
|
||||||
|
"Y-m-d H:i:s",
|
||||||
|
mktime($runHour, 0, 0, date("m"), date("d") + 1, date("y"))
|
||||||
|
);
|
||||||
|
|
||||||
singleton(QueuedJobService::class)->queueJob(
|
singleton(QueuedJobService::class)->queueJob(
|
||||||
$nextRun,
|
$nextRun,
|
||||||
|
@ -8,13 +8,12 @@ use SilverStripe\CMS\Model\VirtualPage;
|
|||||||
use SilverStripe\ContentReview\Compatibility\ContentReviewCompatability;
|
use SilverStripe\ContentReview\Compatibility\ContentReviewCompatability;
|
||||||
use SilverStripe\ContentReview\Extensions\ContentReviewOwner;
|
use SilverStripe\ContentReview\Extensions\ContentReviewOwner;
|
||||||
use SilverStripe\Core\ClassInfo;
|
use SilverStripe\Core\ClassInfo;
|
||||||
use SilverStripe\Core\Config\Config;
|
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\Forms\CheckboxField;
|
use SilverStripe\Forms\CheckboxField;
|
||||||
use SilverStripe\Forms\DateField;
|
use SilverStripe\Forms\DateField;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\i18n\i18n;
|
|
||||||
use SilverStripe\ORM\FieldType\DBDatetime;
|
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||||
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\Reports\Report;
|
use SilverStripe\Reports\Report;
|
||||||
use SilverStripe\Security\Security;
|
use SilverStripe\Security\Security;
|
||||||
use SilverStripe\SiteConfig\SiteConfig;
|
use SilverStripe\SiteConfig\SiteConfig;
|
||||||
@ -81,12 +80,12 @@ class PagesDueForReviewReport extends Report
|
|||||||
$linkPath = parse_url($linkBase, PHP_URL_PATH);
|
$linkPath = parse_url($linkBase, PHP_URL_PATH);
|
||||||
$linkQuery = parse_url($linkBase, PHP_URL_QUERY);
|
$linkQuery = parse_url($linkBase, PHP_URL_QUERY);
|
||||||
|
|
||||||
$fields = array(
|
$fields = [
|
||||||
"Title" => array(
|
"Title" => [
|
||||||
"title" => "Page name",
|
"title" => "Page name",
|
||||||
"formatting" => "<a href='{$linkPath}/\$ID?{$linkQuery}' title='Edit page'>\$value</a>"
|
"formatting" => "<a href='{$linkPath}/\$ID?{$linkQuery}' title='Edit page'>\$value</a>"
|
||||||
),
|
],
|
||||||
"NextReviewDate" => array(
|
"NextReviewDate" => [
|
||||||
"title" => "Review Date",
|
"title" => "Review Date",
|
||||||
"casting" => "Date->Full",
|
"casting" => "Date->Full",
|
||||||
"formatting" => function ($value, $item) {
|
"formatting" => function ($value, $item) {
|
||||||
@ -102,12 +101,12 @@ class PagesDueForReviewReport extends Report
|
|||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
),
|
],
|
||||||
"OwnerNames" => array(
|
"OwnerNames" => [
|
||||||
"title" => "Owner"
|
"title" => "Owner"
|
||||||
),
|
],
|
||||||
"LastEditedByName" => "Last edited by",
|
"LastEditedByName" => "Last edited by",
|
||||||
"AbsoluteLink" => array(
|
"AbsoluteLink" => [
|
||||||
"title" => "URL",
|
"title" => "URL",
|
||||||
"formatting" => function ($value, $item) {
|
"formatting" => function ($value, $item) {
|
||||||
$liveLink = $item->AbsoluteLiveLink;
|
$liveLink = $item->AbsoluteLiveLink;
|
||||||
@ -120,8 +119,8 @@ class PagesDueForReviewReport extends Report
|
|||||||
$liveLink ? "(live)" : "(draft)"
|
$liveLink ? "(live)" : "(draft)"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
),
|
],
|
||||||
"ContentReviewType" => array(
|
"ContentReviewType" => [
|
||||||
"title" => "Settings are",
|
"title" => "Settings are",
|
||||||
"formatting" => function ($value, $item) use ($linkPath, $linkQuery) {
|
"formatting" => function ($value, $item) use ($linkPath, $linkQuery) {
|
||||||
if ($item->ContentReviewType == "Inherit") {
|
if ($item->ContentReviewType == "Inherit") {
|
||||||
@ -141,8 +140,8 @@ class PagesDueForReviewReport extends Report
|
|||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
),
|
],
|
||||||
);
|
];
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
@ -152,7 +151,7 @@ class PagesDueForReviewReport extends Report
|
|||||||
*
|
*
|
||||||
* @return SS_List
|
* @return SS_List
|
||||||
*/
|
*/
|
||||||
public function sourceRecords($params = array())
|
public function sourceRecords($params = [])
|
||||||
{
|
{
|
||||||
Versioned::set_stage(Versioned::DRAFT);
|
Versioned::set_stage(Versioned::DRAFT);
|
||||||
|
|
||||||
|
@ -2,15 +2,16 @@
|
|||||||
|
|
||||||
namespace SilverStripe\ContentReview\Reports;
|
namespace SilverStripe\ContentReview\Reports;
|
||||||
|
|
||||||
use SilverStripe\Forms\CheckboxField;
|
|
||||||
use SilverStripe\Forms\FieldList;
|
|
||||||
use SilverStripe\CMS\Controllers\CMSPageEditController;
|
use SilverStripe\CMS\Controllers\CMSPageEditController;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\CMS\Model\VirtualPage;
|
use SilverStripe\CMS\Model\VirtualPage;
|
||||||
use SilverStripe\ContentReview\Compatibility\ContentReviewCompatability;
|
use SilverStripe\ContentReview\Compatibility\ContentReviewCompatability;
|
||||||
use SilverStripe\Core\ClassInfo;
|
use SilverStripe\Core\ClassInfo;
|
||||||
|
use SilverStripe\Forms\CheckboxField;
|
||||||
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\ORM\ArrayList;
|
use SilverStripe\ORM\ArrayList;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\Reports\Report;
|
use SilverStripe\Reports\Report;
|
||||||
use SilverStripe\SiteConfig\SiteConfig;
|
use SilverStripe\SiteConfig\SiteConfig;
|
||||||
use SilverStripe\Versioned\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
@ -48,20 +49,20 @@ class PagesWithoutReviewScheduleReport extends Report
|
|||||||
$linkPath = parse_url($linkBase, PHP_URL_PATH);
|
$linkPath = parse_url($linkBase, PHP_URL_PATH);
|
||||||
$linkQuery = parse_url($linkBase, PHP_URL_QUERY);
|
$linkQuery = parse_url($linkBase, PHP_URL_QUERY);
|
||||||
|
|
||||||
$fields = array(
|
$fields = [
|
||||||
"Title" => array(
|
"Title" => [
|
||||||
"title" => "Page name",
|
"title" => "Page name",
|
||||||
"formatting" => "<a href='{$linkPath}/\$ID?{$linkQuery}' title='Edit page'>\$value</a>",
|
"formatting" => "<a href='{$linkPath}/\$ID?{$linkQuery}' title='Edit page'>\$value</a>",
|
||||||
),
|
],
|
||||||
"NextReviewDate" => array(
|
"NextReviewDate" => [
|
||||||
"title" => "Review Date",
|
"title" => "Review Date",
|
||||||
"casting" => "Date->Full",
|
"casting" => "Date->Full",
|
||||||
),
|
],
|
||||||
"OwnerNames" => array(
|
"OwnerNames" => [
|
||||||
"title" => "Owner",
|
"title" => "Owner",
|
||||||
),
|
],
|
||||||
"LastEditedByName" => "Last edited by",
|
"LastEditedByName" => "Last edited by",
|
||||||
"AbsoluteLink" => array(
|
"AbsoluteLink" => [
|
||||||
"title" => "URL",
|
"title" => "URL",
|
||||||
"formatting" => function ($value, $item) {
|
"formatting" => function ($value, $item) {
|
||||||
$liveLink = $item->AbsoluteLiveLink;
|
$liveLink = $item->AbsoluteLiveLink;
|
||||||
@ -74,8 +75,8 @@ class PagesWithoutReviewScheduleReport extends Report
|
|||||||
$liveLink ? "(live)" : "(draft)"
|
$liveLink ? "(live)" : "(draft)"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
],
|
||||||
"ContentReviewType" => array(
|
"ContentReviewType" => [
|
||||||
"title" => "Settings are",
|
"title" => "Settings are",
|
||||||
"formatting" => function ($value, $item) use ($linkPath, $linkQuery) {
|
"formatting" => function ($value, $item) use ($linkPath, $linkQuery) {
|
||||||
if ($item->ContentReviewType == "Inherit") {
|
if ($item->ContentReviewType == "Inherit") {
|
||||||
@ -95,8 +96,8 @@ class PagesWithoutReviewScheduleReport extends Report
|
|||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
},
|
},
|
||||||
),
|
],
|
||||||
);
|
];
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
@ -106,7 +107,7 @@ class PagesWithoutReviewScheduleReport extends Report
|
|||||||
*
|
*
|
||||||
* @return SS_List
|
* @return SS_List
|
||||||
*/
|
*/
|
||||||
public function sourceRecords($params = array())
|
public function sourceRecords($params = [])
|
||||||
{
|
{
|
||||||
Versioned::set_stage(Versioned::DRAFT);
|
Versioned::set_stage(Versioned::DRAFT);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class ContentReviewEmails extends BuildTask
|
|||||||
*/
|
*/
|
||||||
protected function getOverduePagesForOwners(SS_List $pages)
|
protected function getOverduePagesForOwners(SS_List $pages)
|
||||||
{
|
{
|
||||||
$overduePages = array();
|
$overduePages = [];
|
||||||
|
|
||||||
foreach ($pages as $page) {
|
foreach ($pages as $page) {
|
||||||
if (!$page->canBeReviewedBy()) {
|
if (!$page->canBeReviewedBy()) {
|
||||||
|
@ -25,7 +25,8 @@ abstract class ContentReviewBaseTest extends FunctionalTest
|
|||||||
/*
|
/*
|
||||||
* We set the locale for pages explicitly, because if we don't, then we get into a situation
|
* We set the locale for pages explicitly, because if we don't, then we get into a situation
|
||||||
* where the page takes on the tester's (your) locale, and any calls to simulate subsequent requests
|
* where the page takes on the tester's (your) locale, and any calls to simulate subsequent requests
|
||||||
* (e.g. $this->post()) do not seem to get passed the tester's locale, but instead fallback to the default locale.
|
* (e.g. $this->post()) do not seem to get passed the tester's locale,
|
||||||
|
* but instead fallback to the default locale.
|
||||||
*
|
*
|
||||||
* So we set the pages locale to be the default locale, which will then match any subsequent requests.
|
* So we set the pages locale to be the default locale, which will then match any subsequent requests.
|
||||||
*
|
*
|
||||||
|
@ -40,7 +40,7 @@ class ContentReviewCMSPageEditControllerTest extends ContentReviewBaseTest
|
|||||||
|
|
||||||
public function testReviewedThrowsExceptionWithNoRecordID()
|
public function testReviewedThrowsExceptionWithNoRecordID()
|
||||||
{
|
{
|
||||||
$this->setExpectedException(HTTPResponse_Exception::class);
|
$this->expectException(HTTPResponse_Exception::class);
|
||||||
|
|
||||||
/** @var CMSPageEditController|ContentReviewCMSExtension $controller */
|
/** @var CMSPageEditController|ContentReviewCMSExtension $controller */
|
||||||
$controller = new CMSPageEditController();
|
$controller = new CMSPageEditController();
|
||||||
@ -55,7 +55,7 @@ class ContentReviewCMSPageEditControllerTest extends ContentReviewBaseTest
|
|||||||
|
|
||||||
public function testReviewedThrowsExceptionWithWrongRecordID()
|
public function testReviewedThrowsExceptionWithWrongRecordID()
|
||||||
{
|
{
|
||||||
$this->setExpectedException(HTTPResponse_Exception::class);
|
$this->expectException(HTTPResponse_Exception::class);
|
||||||
|
|
||||||
/** @var CMSPageEditController|ContentReviewCMSExtension $controller */
|
/** @var CMSPageEditController|ContentReviewCMSExtension $controller */
|
||||||
$controller = new CMSPageEditController();
|
$controller = new CMSPageEditController();
|
||||||
|
@ -70,7 +70,8 @@ class ContentReviewNotificationTest extends SapphireTest
|
|||||||
$email = $this->findEmail($ToEmail, null, $Subject);
|
$email = $this->findEmail($ToEmail, null, $Subject);
|
||||||
$this->assertNotNull($email, "Email haven't been sent.");
|
$this->assertNotNull($email, "Email haven't been sent.");
|
||||||
$this->assertContains(
|
$this->assertContains(
|
||||||
"<h1>$Subject</h1><p>There are $PagesCount pages that are due for review today by you, $ToFirstName.</p><p>This email was sent to $ToEmail</p>",
|
"<h1>$Subject</h1><p>There are $PagesCount pages that are due for review today by you, "
|
||||||
|
. "$ToFirstName.</p><p>This email was sent to $ToEmail</p>",
|
||||||
$email['HtmlContent']
|
$email['HtmlContent']
|
||||||
);
|
);
|
||||||
$this->assertContains('Staff', $email['HtmlContent']);
|
$this->assertContains('Staff', $email['HtmlContent']);
|
||||||
|
@ -47,27 +47,27 @@ class ContentReviewReportTest extends FunctionalTest
|
|||||||
$report->columns();
|
$report->columns();
|
||||||
$report->title();
|
$report->title();
|
||||||
|
|
||||||
$results = $report->sourceRecords(array(
|
$results = $report->sourceRecords([
|
||||||
"ReviewDateAfter" => "2010-01-01",
|
"ReviewDateAfter" => "2010-01-01",
|
||||||
"ReviewDateBefore" => "2010-12-12",
|
"ReviewDateBefore" => "2010-12-12",
|
||||||
));
|
]);
|
||||||
|
|
||||||
$this->assertEquals(array(
|
$this->assertEquals([
|
||||||
"Contact Us Child",
|
"Contact Us Child",
|
||||||
"Home",
|
"Home",
|
||||||
"About Us",
|
"About Us",
|
||||||
"Staff",
|
"Staff",
|
||||||
"Contact Us",
|
"Contact Us",
|
||||||
), $results->column("Title"));
|
], $results->column("Title"));
|
||||||
|
|
||||||
DBDatetime::set_mock_now("2010-02-13 00:00:00");
|
DBDatetime::set_mock_now("2010-02-13 00:00:00");
|
||||||
|
|
||||||
$results = $report->sourceRecords(array());
|
$results = $report->sourceRecords([]);
|
||||||
|
|
||||||
$this->assertEquals(array(
|
$this->assertEquals([
|
||||||
"Home",
|
"Home",
|
||||||
"About Us",
|
"About Us",
|
||||||
), $results->column("Title"));
|
], $results->column("Title"));
|
||||||
|
|
||||||
DBDatetime::clear_mock_now();
|
DBDatetime::clear_mock_now();
|
||||||
}
|
}
|
||||||
@ -87,11 +87,11 @@ class ContentReviewReportTest extends FunctionalTest
|
|||||||
|
|
||||||
$results = $report->sourceRecords();
|
$results = $report->sourceRecords();
|
||||||
|
|
||||||
$this->assertEquals(array(
|
$this->assertEquals([
|
||||||
"Home",
|
"Home",
|
||||||
"About Us",
|
"About Us",
|
||||||
"Page without review date",
|
"Page without review date",
|
||||||
"Page owned by group",
|
"Page owned by group",
|
||||||
), $results->column("Title"));
|
], $results->column("Title"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\ContentReview\Tests;
|
namespace SilverStripe\ContentReview\Tests;
|
||||||
|
|
||||||
|
use function date;
|
||||||
use Page;
|
use Page;
|
||||||
use SilverStripe\CMS\Controllers\CMSPageEditController;
|
use SilverStripe\CMS\Controllers\CMSPageEditController;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
@ -80,7 +81,10 @@ class ContentReviewSettingsTest extends SapphireTest
|
|||||||
|
|
||||||
$page->write();
|
$page->write();
|
||||||
|
|
||||||
$this->assertEquals(date('Y-m-d', strtotime("now + " . $page->ReviewPeriodDays . " days")), $page->NextReviewDate);
|
$this->assertEquals(
|
||||||
|
date('Y-m-d', strtotime("now + " . $page->ReviewPeriodDays . " days")),
|
||||||
|
$page->NextReviewDate
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAdvanceReviewFromInheritedSettings()
|
public function testAdvanceReviewFromInheritedSettings()
|
||||||
@ -112,7 +116,10 @@ class ContentReviewSettingsTest extends SapphireTest
|
|||||||
|
|
||||||
$page->write();
|
$page->write();
|
||||||
|
|
||||||
$this->assertEquals(date('Y-m-d', strtotime("now + " . $siteConfig->ReviewPeriodDays . " days")), $page->NextReviewDate);
|
$this->assertEquals(
|
||||||
|
date('Y-m-d', strtotime("now + " . $siteConfig->ReviewPeriodDays . " days")),
|
||||||
|
$page->NextReviewDate
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetSettingsObjectFromCustom()
|
public function testGetSettingsObjectFromCustom()
|
||||||
|
@ -5,15 +5,15 @@ namespace SilverStripe\ContentReview\Tests;
|
|||||||
use Page;
|
use Page;
|
||||||
use SilverStripe\CMS\Controllers\CMSPageEditController;
|
use SilverStripe\CMS\Controllers\CMSPageEditController;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\ContentReview\Extensions\SiteTreeContentReview;
|
|
||||||
use SilverStripe\ContentReview\Extensions\ContentReviewOwner;
|
|
||||||
use SilverStripe\ContentReview\Extensions\ContentReviewCMSExtension;
|
use SilverStripe\ContentReview\Extensions\ContentReviewCMSExtension;
|
||||||
use SilverStripe\ContentReview\Extensions\ContentReviewDefaultSettings;
|
use SilverStripe\ContentReview\Extensions\ContentReviewDefaultSettings;
|
||||||
|
use SilverStripe\ContentReview\Extensions\ContentReviewOwner;
|
||||||
|
use SilverStripe\ContentReview\Extensions\SiteTreeContentReview;
|
||||||
use SilverStripe\Forms\LiteralField;
|
use SilverStripe\Forms\LiteralField;
|
||||||
|
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||||
use SilverStripe\Security\Group;
|
use SilverStripe\Security\Group;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
use SilverStripe\SiteConfig\SiteConfig;
|
use SilverStripe\SiteConfig\SiteConfig;
|
||||||
use SilverStripe\ORM\FieldType\DBDatetime;
|
|
||||||
use SilverStripe\Versioned\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,7 +63,7 @@ class SiteTreeContentReviewTest extends ContentReviewBaseTest
|
|||||||
$page->write();
|
$page->write();
|
||||||
|
|
||||||
$this->assertTrue($page->canPublish());
|
$this->assertTrue($page->canPublish());
|
||||||
$this->assertTrue($page->doPublish());
|
$this->assertTrue($page->publishRecursive());
|
||||||
$this->assertEquals("", $page->OwnerNames);
|
$this->assertEquals("", $page->OwnerNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user