add a new field for Review Info, and display it when it has data on the quick review panel, as well as in the main cms screen

This commit is contained in:
Julian 2016-08-23 15:36:16 +12:00
parent 4f287bb508
commit 1e4880998d
1 changed files with 14 additions and 1 deletions

View File

@ -25,6 +25,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
"NextReviewDate" => "Date",
"LastEditedByName" => "Varchar(255)",
"OwnerNames" => "Varchar(255)",
"ReviewInfo" => "Text"
);
/**
@ -126,13 +127,22 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
"<label class=\"left\" for=\"Form_EditForm_ReviewNotes\">" . _t("ContentReview.CONTENTREVIEW", "Content due for review") . "</label>"
);
if (strlen($this->owner->ReviewInfo) > 0) {
$reviewInfo = LiteralField::create(
"ReviewContentInfo",
"<p class=\"quick-info\">" . $this->owner->ReviewInfo . "</p>"
);
} else {
$reviewInfo = '';
}
$ReviewNotes = LiteralField::create("ReviewNotes", "<textarea class=\"no-change-track\" id=\"Form_EditForm_ReviewNotes\" name=\"ReviewNotes\" placeholder=\"" . _t("ContentReview.COMMENTS", "(optional) Add comments...") . "\" class=\"text\"></textarea>");
$quickReviewAction = FormAction::create("savereview", _t("ContentReview.MARKREVIEWED", "Mark as reviewed"))
->setAttribute("data-icon", "pencil")
->setAttribute("data-text-alternate", _t("ContentReview.MARKREVIEWED", "Mark as reviewed"));
$allFields = CompositeField::create($reviewTitle, $ReviewNotes, $quickReviewAction)
$allFields = CompositeField::create($reviewTitle, $reviewInfo, $ReviewNotes, $quickReviewAction)
->addExtraClass('review-notes field');
$reviewTab = Tab::create('ReviewContent', $allFields);
@ -383,6 +393,8 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
->addExtraClass('custom-setting')
->setDescription(_t("ContentReview.REVIEWFREQUENCYDESCRIPTION", "The review date will be set to this far in the future whenever the page is published"));
$reviewInfoField = TextareaField::create("ReviewInfo", _t("ContentReview.REVIEWINFO", "Review information"));
$notesField = GridField::create("ReviewNotes", "Review Notes", $this->owner->ReviewLogs(), GridFieldConfig_RecordEditor::create());
$fields->addFieldsToTab("Root.ContentReview", array(
@ -395,6 +407,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
$reviewFrequency
)->addExtraClass("review-settings"),
ReadonlyField::create("ROContentOwners", _t("ContentReview.CONTENTOWNERS", "Content Owners"), $this->getOwnerNames()),
$reviewInfoField,
$notesField,
));
}