include review info in the in the recorded content review

This commit is contained in:
Julian 2016-08-29 19:13:23 +12:00
parent d73a96fa8f
commit e02991ef05
3 changed files with 10 additions and 6 deletions

View File

@ -31,9 +31,8 @@ class ContentReviewCMSExtension extends LeftAndMainExtension
} }
$notes = (!empty($data["ReviewNotes"]) ? $data["ReviewNotes"] : _t("ContentReview.NOCOMMENTS", "(no comments)")); $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(); $page->advanceReviewDate();
$this->owner->getResponse()->addHeader("X-Status", _t("ContentReview.REVIEWSUCCESSFUL", "Content reviewed successfully")); $this->owner->getResponse()->addHeader("X-Status", _t("ContentReview.REVIEWSUCCESSFUL", "Content reviewed successfully"));
return $this->owner->redirectBack(); return $this->owner->redirectBack();
} }

View File

@ -418,11 +418,14 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
* @param Member $reviewer * @param Member $reviewer
* @param string $message * @param string $message
*/ */
public function addReviewNote(Member $reviewer, $message) public function addReviewNote(Member $reviewer, $message, $reviewInfo = null)
{ {
$reviewLog = ContentReviewLog::create(); $reviewLog = ContentReviewLog::create();
$reviewLog->Note = $message; $reviewLog->Note = $message;
$reviewLog->ReviewerID = $reviewer->ID; $reviewLog->ReviewerID = $reviewer->ID;
if ($reviewInfo) {
$reviewLog->ReviewInfo = $reviewInfo;
}
$this->owner->ReviewLogs()->add($reviewLog); $this->owner->ReviewLogs()->add($reviewLog);
} }

View File

@ -7,6 +7,7 @@ class ContentReviewLog extends DataObject
*/ */
private static $db = array( private static $db = array(
"Note" => "Text", "Note" => "Text",
"ReviewInfo" => "Text"
); );
/** /**
@ -21,9 +22,10 @@ class ContentReviewLog extends DataObject
* @var array * @var array
*/ */
private static $summary_fields = array( private static $summary_fields = array(
"Note" => array("title" => "Note"), "ReviewInfo" => array("title" => "Review Information"),
"Created" => array("title" => "Reviewed at"), "Note" => array("title" => "Note"),
"Reviewer.Title" => array("title" => "Reviewed by"), "Created" => array("title" => "Reviewed at"),
"Reviewer.Title" => array("title" => "Reviewed by"),
); );
/** /**