mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
BUG: Missing preview archive version button (fixes 7656)
Added missing preview button
This commit is contained in:
parent
795964275a
commit
7c0e38707c
@ -97,8 +97,11 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
// Respect permission failures from parent implementation
|
// Respect permission failures from parent implementation
|
||||||
if(!($form instanceof Form)) return $form;
|
if(!($form instanceof Form)) return $form;
|
||||||
|
|
||||||
|
$nav = new SilverStripeNavigatorItem_ArchiveLink($record);
|
||||||
|
|
||||||
$form->setActions(new FieldList(
|
$form->setActions(new FieldList(
|
||||||
$revert = FormAction::create('doRollback', _t('CMSPageHistoryController.REVERTTOTHISVERSION', 'Revert to this version'))->setUseButtonTag(true)
|
$revert = FormAction::create('doRollback', _t('CMSPageHistoryController.REVERTTOTHISVERSION', 'Revert to this version'))->setUseButtonTag(true),
|
||||||
|
$navField = new LiteralField('ArchivedLink', $nav->getHTML())
|
||||||
));
|
));
|
||||||
|
|
||||||
$fields = $form->Fields();
|
$fields = $form->Fields();
|
||||||
@ -106,8 +109,9 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
$fields->push(new HiddenField("ID"));
|
$fields->push(new HiddenField("ID"));
|
||||||
$fields->push(new HiddenField("Version"));
|
$fields->push(new HiddenField("Version"));
|
||||||
|
|
||||||
$fields = $fields->makeReadonly();
|
$fields = $fields->makeReadonly();
|
||||||
|
$navField->setAllowHTML(true);
|
||||||
|
|
||||||
foreach($fields->dataFields() as $field) {
|
foreach($fields->dataFields() as $field) {
|
||||||
$field->dontEscape = true;
|
$field->dontEscape = true;
|
||||||
$field->reserveNL = true;
|
$field->reserveNL = true;
|
||||||
|
@ -308,10 +308,10 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
|
|||||||
|
|
||||||
function getHTML() {
|
function getHTML() {
|
||||||
$this->recordLink = $this->record->AbsoluteLink();
|
$this->recordLink = $this->record->AbsoluteLink();
|
||||||
return "<a href=\"$this->recordLink?archiveDate={$this->record->LastEdited}\" target=\"_blank\">". _t('ContentController.ARCHIVEDSITE', 'Archived Site') ."</a>";
|
return "<a class=\"ss-ui-button\" href=\"$this->recordLink?archiveDate={$this->record->LastEdited}\" target=\"_blank\">". _t('ContentController.ARCHIVEDSITE', 'Preview version') ."</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMessage() {
|
function getMessage() {
|
||||||
if($date = Versioned::current_archived_date()) {
|
if($date = Versioned::current_archived_date()) {
|
||||||
$dateObj = Datetime::create();
|
$dateObj = Datetime::create();
|
||||||
$dateObj->setValue($date);
|
$dateObj->setValue($date);
|
||||||
|
Loading…
Reference in New Issue
Block a user