Comparing files in document library

I always thought that it would be very nice if we could compare text files in the document library portlet, just like we developers do with different versions of source code. I finally implemented this diff tool and had a lot of fun!

For the first time I think I've made something similar to test-driven development and it'd proven to be very useful for this kind of algorithm in which a small change can break something else that you didn't know it was related.

You can also compare other file types besides .txt, like .doc, .odt or .html. Thanks to the OpenOffice integration we made some weeks ago.

Some aesthetic changes need to be done, as Jorge advised me, Wikimedia's way of choosing different versions is better, it has two columns of radio buttons instead of one column of checkboxes. The way the differences are shown also needs to get better, suggestions please.

Here are the screenshots:

 

...and displaying the result:

 

Blogs
Hey Bruno,

Good job. I think the way to show differences is very good. Also, regarding the way versions to be compared is good too. WikiMedia's is maybe a little better, but this one may seem more familiar to people and is more consistent with other Liferay portlets.

Maybe we should just add some JavaScript so that when two are selected you cannot select any other. And only when you have selected two the button is enabled.
Hi Jorge,

Yes, there is a js that only allows you to choose up to 2 versions.

The selection works like this:

1. if no checkbox is selected, compare the 2 most recent versions.
2. if only one is selected, compare this one with the current version.
3. and of course, if 2 are selected, compare those 2.