Posted by gpk on April 29, 2009 at 8:14pm
| Project: | Diff |
| Version: | 6.x-2.1-alpha1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Maybe I'm missing something obvious, but I've checked the box "Show diffs inline for this content type" and I can't see any change in the diff output/behaviour (still 2-column side-by-side).
Any ideas??
TIA
Comments
#1
Changing status.
I've double checked my content type settings. and from scanning this http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/diff/diff.m... it seems I should be seeing additional options (inline diff form) when viewing a page? But there seems to be nothing there..!
Maybe I've overlooked something, but part of the problem is I don't know where to look to find the inline diff stuff.
#2
Updating title.
#3
Yeah there is no documentation of the new features, so initially it throws you for a loop. The new inline functionality can be harnessed via a button entitled "Highlight changes" under the view tab of the node. After punching it you get a drop down selection to checkout inline diffs; different from what I expected. Nevertheless very welcomed features!
#4
Thanks, where is this button? Have tried changing the site theme to Garland but still no sign of it when viewing a node!
I wonder if OG or another module is interfering somehow..
#5
Had an idea ... I can see the button if I log in as user 1.
What seems to be happening is that Highlight changes specifically requires "view revisions" permission, whereas viewing revisions can be done via administer nodes permission.
This turns out to be useful since the diff-inline-form somewhat breaks my page layout..! So I'm glad to be able to hide the resulting mess from other content admins!
#6
I just updated to latest dev and it worked for me. I saw it on OpenAtrium's home and really liked it!
#7
I see the "highlight changes" button, but not the results. I see only legend with coloured background, but no changes (differences in background colour) in the text. Neither the changed parts of text have any additional class related to diff module. It is the same for the last stable and last -dev version. Thank you in advance for help.
#8
Same for me.
"Hightlight changes"-Button appears, coloured legend is shown, nodes without revisions do not have that stuff.
But there is no effect for the display, neither for user 1 nor other users.
Has to happen some css-tweaking or other kinds of stuff to get it working?
Would really love to have that nice feature for my wiki pages.
Is there some documentation about this?
#9
I am not seeing the highlighted text as well.
#10
I'm seeing the link to show inline diffs but when I click it differences aren't highlighted, if I use Show Diffs from the Revisions tab the differences are displayed correctly.
I tested this with alpha 3 and dev releases
#11
I've found what I believe to be the cause of this issue but I'm not entirely sure how to fix it.
For starters will need to change
$old = db_fetch_object(db_query("SELECT body, format FROM {node_revisions} WHERE nid = %d AND vid = %d", $node->nid, $target_vid));to
$old = node_load($node->nid, $target_vid, TRUE);So that cck fields will be available to the preg_split code.
But I have no idea how to refactor the preg_split code to also act against cck fields and then reassemble for $output...
diff.pages.inc line 388
/**
* Generate a rendered inline diff of the node body.
*/
function diff_inline_diff($node, $target_vid) {
module_load_include('php', 'diff', 'DiffEngine');
$new = drupal_clone($node);
// We could use a node_load() / node_prepare() combo here but for now
// we would rather save queries...
$old = db_fetch_object(db_query("SELECT body, format FROM {node_revisions} WHERE nid = %d AND vid = %d", $node->nid, $target_vid));
$old->body = check_markup($old->body, $old->format, FALSE);
$new = preg_split('/(<[^>]+?>| )/', $new->body, -1, PREG_SPLIT_DELIM_CAPTURE);
$old = preg_split('/(<[^>]+?>| )/', $old->body, -1, PREG_SPLIT_DELIM_CAPTURE);
$diff = new Diff($old, $new);
$diff->edits = _diff_inline_process_edits($diff->edits);
// Assemble highlighted output
$output = '';
foreach ($diff->edits as $chunk) {
switch ($chunk->type) {
case 'copy':
$output .= implode("", $chunk->closing);
break;
case 'delete':
foreach ($chunk->orig as $i => $piece) {
if (strpos($piece, '<') === 0 && substr($piece, strlen($piece) - 1) === '>') {
$output .= $piece;
}
else {
$output .= theme('diff_inline_chunk', $piece, $chunk->type);
}
}
break;
default:
$chunk->closing = _diff_inline_process_chunk($chunk->closing);
foreach ($chunk->closing as $i => $piece) {
if ($piece === ' ' || (strpos($piece, '<') === 0 && substr($piece, strlen($piece) - 1) === '>')) {
$output .= $piece;
}
else {
$output .= theme('diff_inline_chunk', $piece, $chunk->type);
}
}
break;
}
}
return $output;
}
#12
Patch attached
#13
This patch doesnt help.
But I already have applied
http://drupal.org/node/639320 Patch #24
and http://drupal.org/node/372957 Patch #8
With the help of these I was able to see the "Highlight changes" button (sometimes). Sometimes the changes were already colored, but I dont see the button. Sometimes I see the button, but no colors. Nevertheless the above mentioned patches do fix the problem "partially".
Patch #11 doesnt improve this. :( [Without the patches mentioned above I cant get diff running with php5.3 :/ ]
#14
I found yesterday my patch at #12 only works if your template renders the node->content , using a custom tpl or contemplate will likely stop it from displaying correctly.
I'm not using php 5.3 here so am unable to test my changes to see if 5.3 causes additional issues
#15
Thanks, committed: http://drupal.org/cvs?commit=405702
#16
This patch seems to almost perfectly work for me. I have php 5.2x installed. The only issue I note is that on nodes that have fieldsets collapsed, the collapsed fieldsets do not render the inline diff. If I open the fieldsets, the diff works perfectly...
#17
Automatically closed -- issue fixed for 2 weeks with no activity.