From e02991ef059ee07899a713051d453016e3058ed3 Mon Sep 17 00:00:00 2001 From: Julian Date: Mon, 29 Aug 2016 19:13:23 +1200 Subject: [PATCH] include review info in the in the recorded content review --- code/extensions/ContentReviewCMSExtension.php | 3 +-- code/extensions/SiteTreeContentReview.php | 5 ++++- code/models/ContentReviewLog.php | 8 +++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/code/extensions/ContentReviewCMSExtension.php b/code/extensions/ContentReviewCMSExtension.php index c22b565..1300954 100644 --- a/code/extensions/ContentReviewCMSExtension.php +++ b/code/extensions/ContentReviewCMSExtension.php @@ -31,9 +31,8 @@ class ContentReviewCMSExtension extends LeftAndMainExtension } $notes = (!empty($data["ReviewNotes"]) ? $data["ReviewNotes"] : _t("ContentReview.NOCOMMENTS", "(no comments)")); - $page->addReviewNote(Member::currentUser(), $notes); + $page->addReviewNote(Member::currentUser(), $notes, $page->ReviewInfo); $page->advanceReviewDate(); - $this->owner->getResponse()->addHeader("X-Status", _t("ContentReview.REVIEWSUCCESSFUL", "Content reviewed successfully")); return $this->owner->redirectBack(); } diff --git a/code/extensions/SiteTreeContentReview.php b/code/extensions/SiteTreeContentReview.php index f8f209b..d467261 100644 --- a/code/extensions/SiteTreeContentReview.php +++ b/code/extensions/SiteTreeContentReview.php @@ -418,11 +418,14 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider * @param Member $reviewer * @param string $message */ - public function addReviewNote(Member $reviewer, $message) + public function addReviewNote(Member $reviewer, $message, $reviewInfo = null) { $reviewLog = ContentReviewLog::create(); $reviewLog->Note = $message; $reviewLog->ReviewerID = $reviewer->ID; + if ($reviewInfo) { + $reviewLog->ReviewInfo = $reviewInfo; + } $this->owner->ReviewLogs()->add($reviewLog); } diff --git a/code/models/ContentReviewLog.php b/code/models/ContentReviewLog.php index 4c890c8..d6caeb6 100644 --- a/code/models/ContentReviewLog.php +++ b/code/models/ContentReviewLog.php @@ -7,6 +7,7 @@ class ContentReviewLog extends DataObject */ private static $db = array( "Note" => "Text", + "ReviewInfo" => "Text" ); /** @@ -21,9 +22,10 @@ class ContentReviewLog extends DataObject * @var array */ private static $summary_fields = array( - "Note" => array("title" => "Note"), - "Created" => array("title" => "Reviewed at"), - "Reviewer.Title" => array("title" => "Reviewed by"), + "ReviewInfo" => array("title" => "Review Information"), + "Note" => array("title" => "Note"), + "Created" => array("title" => "Reviewed at"), + "Reviewer.Title" => array("title" => "Reviewed by"), ); /**