mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
BUGFIX: Fixed bugs in content differencer, and improved styling.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@77661 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
ef2c47feb8
commit
646ed9342a
@ -847,12 +847,16 @@ JS;
|
||||
$record = $page->compareVersions($fromVersion, $toVersion);
|
||||
$fromVersionRecord = Versioned::get_version('SiteTree', $id, $fromVersion);
|
||||
$toVersionRecord = Versioned::get_version('SiteTree', $id, $toVersion);
|
||||
if(!$fromVersionRecord) user_error("Can't find version $fromVersion of page $id", E_USER_ERROR);
|
||||
if(!$toVersionRecord) user_error("Can't find version $toVersion of page $id", E_USER_ERROR);
|
||||
|
||||
if($record) {
|
||||
$fromDateNice = $fromVersionRecord->obj('LastEdited')->Ago();
|
||||
$toDateNice = $toVersionRecord->obj('LastEdited')->Ago();
|
||||
$fromAuthor = DataObject::get_by_id('Member', $fromVersionRecord->AuthorID);
|
||||
if(!$fromAuthor) $fromAuthor = new ArrayData(array('Title' => 'Unknown author'));
|
||||
$toAuthor = DataObject::get_by_id('Member', $toVersionRecord->AuthorID);
|
||||
if(!$toAuthor) $toAuthor = new ArrayData(array('Title' => 'Unknown author'));
|
||||
|
||||
$fields = $record->getCMSFields($this);
|
||||
$fields->push(new HiddenField("ID"));
|
||||
|
@ -668,6 +668,9 @@ class Diff
|
||||
// Diff that
|
||||
$diff = new Diff($set1, $set2);
|
||||
|
||||
$tagStack[1] = $tagStack[2] = 0;
|
||||
$rechunked[1] = $rechunked[2] = array();
|
||||
|
||||
// Go through everything, converting edited tags (and their content) into single chunks. Otherwise
|
||||
// the generated HTML gets crusty
|
||||
foreach($diff->edits as $edit) {
|
||||
@ -704,12 +707,12 @@ class Diff
|
||||
if($chunks) {
|
||||
foreach($chunks as $item) {
|
||||
// $tagStack > 0 indicates that we should be tag-building
|
||||
if(isset($tagStack[$listName])) $rechunked[$listName][sizeof($rechunked[$listName])-1] .= ' ' . $item;
|
||||
if($tagStack[$listName]) $rechunked[$listName][sizeof($rechunked[$listName])-1] .= ' ' . $item;
|
||||
else $rechunked[$listName][] = $item;
|
||||
|
||||
if($lookForTag && isset($item[0]) && $item[0] == "<" && substr($item,0,2) != "</") {
|
||||
$tagStack[$listName] = 1;
|
||||
} else if(isset($tagStack[$listName])) {
|
||||
} else if($tagStack[$listName]) {
|
||||
if(substr($item,0,2) == "</") $tagStack[$listName]--;
|
||||
else if(isset($item[0]) && $item[0] == "<") $tagStack[$listName]++;
|
||||
}
|
||||
@ -720,7 +723,6 @@ class Diff
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Diff the re-chunked data, turning it into maked up HTML
|
||||
$diff = new Diff($rechunked[1], $rechunked[2]);
|
||||
$content = '';
|
||||
|
@ -394,15 +394,14 @@ ul.tree span.untranslated a:visited {
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
/* Change detection CSS */
|
||||
#right ins, #right ins * {
|
||||
background-color: green;
|
||||
color: white;
|
||||
background-color: #99EE66;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#right del, #right del *{
|
||||
background-color: red;
|
||||
color: white;
|
||||
background-color: #FF9999;
|
||||
text-decoration: strikethough;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user