Merge pull request #174 from adrexia/add-archive

BUG: Missing preview archive version button (fixes 7656)
This commit is contained in:
Will Rossiter 2012-08-09 02:57:59 -07:00
commit 24ce0c199a
2 changed files with 9 additions and 5 deletions

View File

@ -97,8 +97,11 @@ class CMSPageHistoryController extends CMSMain {
// Respect permission failures from parent implementation
if(!($form instanceof Form)) return $form;
$nav = new SilverStripeNavigatorItem_ArchiveLink($record);
$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();
@ -106,8 +109,9 @@ class CMSPageHistoryController extends CMSMain {
$fields->push(new HiddenField("ID"));
$fields->push(new HiddenField("Version"));
$fields = $fields->makeReadonly();
$fields = $fields->makeReadonly();
$navField->setAllowHTML(true);
foreach($fields->dataFields() as $field) {
$field->dontEscape = true;
$field->reserveNL = true;

View File

@ -308,10 +308,10 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
function getHTML() {
$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()) {
$dateObj = Datetime::create();
$dateObj->setValue($date);