Skip to content
This repository
Browse code

BUG: Missing preview archive version button (fixes 7656)

Added missing preview button
  • Loading branch information...
commit 7c0e38707cf82900ac07d4a0b0764810a7f1b1bd 1 parent 7959642
Naomi Guyer authored July 31, 2012
10  code/controllers/CMSPageHistoryController.php
@@ -97,8 +97,11 @@ function getEditForm($id = null, $fields = null, $versionID = null, $compareID =
97 97
 		// Respect permission failures from parent implementation
98 98
 		if(!($form instanceof Form)) return $form;
99 99
 
  100
+		$nav = new SilverStripeNavigatorItem_ArchiveLink($record);
  101
+
100 102
 		$form->setActions(new FieldList(
101  
-			$revert = FormAction::create('doRollback', _t('CMSPageHistoryController.REVERTTOTHISVERSION', 'Revert to this version'))->setUseButtonTag(true)
  103
+			$revert = FormAction::create('doRollback', _t('CMSPageHistoryController.REVERTTOTHISVERSION', 'Revert to this version'))->setUseButtonTag(true),
  104
+			$navField = new LiteralField('ArchivedLink', $nav->getHTML())
102 105
 		));
103 106
 		
104 107
 		$fields = $form->Fields();
@@ -106,8 +109,9 @@ function getEditForm($id = null, $fields = null, $versionID = null, $compareID =
106 109
 		$fields->push(new HiddenField("ID"));
107 110
 		$fields->push(new HiddenField("Version"));
108 111
 		
109  
-		$fields = $fields->makeReadonly();
110  
-
  112
+		$fields = $fields->makeReadonly();		
  113
+		$navField->setAllowHTML(true);
  114
+		
111 115
 		foreach($fields->dataFields() as $field) {
112 116
 			$field->dontEscape = true;
113 117
 			$field->reserveNL = true;
4  code/controllers/SilverStripeNavigator.php
@@ -308,10 +308,10 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
308 308
 
309 309
 	function getHTML() {
310 310
 			$this->recordLink = $this->record->AbsoluteLink();
311  
-			return "<a href=\"$this->recordLink?archiveDate={$this->record->LastEdited}\" target=\"_blank\">". _t('ContentController.ARCHIVEDSITE', 'Archived Site') ."</a>";
  311
+			return "<a class=\"ss-ui-button\" href=\"$this->recordLink?archiveDate={$this->record->LastEdited}\" target=\"_blank\">". _t('ContentController.ARCHIVEDSITE', 'Preview version') ."</a>";
312 312
 	}
313 313
 	
314  
-	function getMessage() {
  314
+	function getMessage() { 
315 315
 		if($date = Versioned::current_archived_date()) {
316 316
 			$dateObj = Datetime::create();
317 317
 			$dateObj->setValue($date);

0 notes on commit 7c0e387

Please sign in to comment.
Something went wrong with that request. Please try again.