Compare Two Different Nodes
Rob Loach - October 31, 2007 - 18:31
| Project: | Diff |
| Version: | 5.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Provide a menu item at diff/[nid]/[nid] to compare the differences between two nodes.

#1
Yup, that'd be cool. Feel free to roll a patch -- I'd be willing to review, and if ready, commit it.
Cheers,
-Derek
#2
Further thoughts:
A) How would this feature be exposed in the UI (if at all). would node/%/diff become a new tab where you get some kind of node selector widget (drop down for a small site, autocomplete for a larger site, possibly a view with some exposed filters you could refine, etc)? I'm not sure if I think that's a good idea yet. But, how else would people using diff know about this functionality, if they don't happen to be reading this issue?
B) For extra credit, there'd be other arguments to specify the revisions of each node you wanted to compare. Of course, by default, it'd just compare the current revisions of each node. Of course, this further complicates the UI question in (A), so we might want to just forget about this idea entirely. ;)
#3
It would be very usefull feature!
I think it must be done in such way:
1. Every node has a link " Add to comparу list"
2. On campare page we see a table: each column of it - is a node property, and each row - ia a different node.
#4
I'd also interested and willing to test. I am beginning with PHP but confident enough with Drupal's Data Structure
#5
A separate page should be provided for selection of the two nodes in a similar manner as revision selection is done now except with different selection mechanisms. That way there's only a single page and minimal UI to deal with, and it can be placed in a menu wherever one wants it. There's no need to put a tab on every node.
If the UI appeared on its own page, this would be easy to add. It could be AJAX-based for people with Javascript enabled to display the relevant revisions of the selected nodes on the same page once the nodes were chosen. For people without Javascript there could just be a "Next" button which would take you to a page where you chose the revisions.
I'm not capable of writing this myself but I'm more than happy to test the feature and/or look over the code.
#6
except with different selection mechanisms
Yeah, that's my point. What mechanisms? What if you're talking drupal.org with more than 250,000 nodes? A drop-down menu of node titles obviously won't do the trick. ;) We'd need a ton of fancy sorting/filtering options, or more likely, a view with a bunch of exposed filters, to even get close to something that could work... There are entire modules written just trying to solve this problem.
The problem with this issue isn't a general question about "could this work?" It's a very specific UI problem of "how exactly would this work in practice on sites ranging from a handful of nodes to hundreds of thousands of nodes?".
#7
Use this method: http://drupal.org/project/node_quick_find
Probably in conjunction with a content-type filter. Alternatively the Ajax-search tool in JSTools could be used.
#8
Would you accept a patch to make this programatically available, for starters?
#9
More information: I imagine a function that accepts as parameters two nid, vid pairs and performs a diff.
#10
If you rework the current module to use that API function, then it is an improvement and will be committed. We must eat our own dogfood.
#11
To be sure I understand what you mean, would that entail modifying diff_diffs_show(&$node, $old_vid, $new_vid) and calls to it so that it accepts 2 nid, vid pairs or writing a separate function to accept those parameters?
#12
I haven't looked into it, but rewriting that function looks like a reasonable approach. Whichever you think is best. I just don't want two parallel code paths.
#13
Subscribing.
#14
Subscribing.
If you're looking for a use-case I have a site about insects where each insect species has a node with images and information and it would be very useful to be able to compare images and/or selected other fields between 2 different species(nodes). Preferably with some sort of a "compare this node" button on all nodes (of admin specified type?) and then a comparison page where you select fields to compare.
#15
#14: I think that currently this module is only concerned with comparing text, not images.
To be able to select CCK fields to compare would be an interesting development, though.
#16
Subscrbing.
There are lots of "comparison" module request out there. so many sites could make use of this function.
most are taking the cck+views+panels approach.
The problem I'm having with those is simple - users are not able to select WHICH fields/aspects to compare.
Could the diff approach be more useful in this case...?
Thank ;)