Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BUGFIX Marking fields as readonly in CMSMain->compareversions() befor…

…e loading data, to avoid loading invalid values (HTML diffs) into the fields (AIR-39)
  • Loading branch information...
commit f7d322a004c435c4283ff15e0e9d9d734899d3cf 1 parent 093eb6c
@chillu chillu authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 code/controllers/CMSPageHistoryController.php
View
13 code/controllers/CMSPageHistoryController.php
@@ -409,14 +409,23 @@ function CompareVersionsForm($versionID, $otherVersionID) {
if($record) {
$form = $this->getEditForm($id, null, null, true);
$form->setActions(new FieldSet());
- $form->loadDataFrom($record);
+ $form->addExtraClass('compare');
+
+ // Comparison views shouldn't be editable.
+ // Its important to convert fields *before* loading data,
+ // as the comparison output is HTML and not valid values for the various field types
+ $readonlyFields = $form->Fields()->makeReadonly();
+ $form->setFields($readonlyFields);
+ $form->loadDataFrom($record);
$form->loadDataFrom(array(
"ID" => $id,
"Version" => $fromVersion,
));
- $form->addExtraClass('compare');
+ foreach($form->Fields()->dataFields() as $field) {
+ $field->dontEscape = true;
+ }
return $form;
}
Please sign in to comment.
Something went wrong with that request. Please try again.