« Back

Comparing files in document library

Company Blogs January 31, 2008 By Bruno Farache Staff

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:

 

Threaded Replies Author Date
It is a great idea. Is it only limited to open... Shepherd Ching January 31, 2008 10:11 PM
Hi Shepherd, you can set in portal.properties... Bruno Farache February 1, 2008 2:58 AM
Hey Bruno, Good job. I think the way to show... Jorge Ferrer February 1, 2008 6:09 AM
Hi Jorge, Yes, there is a js that only allows... Bruno Farache February 1, 2008 6:24 AM
I like your new picture Bruno :) Brian Chan February 1, 2008 10:32 AM
Awesome! :) Jorge Ferrer February 5, 2008 3:56 AM
How can I Remove "Front page" Heading in... Sravani M November 4, 2010 4:55 AM

It is a great idea.
Is it only limited to open office or text file format ?
Posted on 1/31/08 10:11 PM.
Hi Shepherd, you can set in portal.properties which file extensions are comparable.
Posted on 2/1/08 2:58 AM in reply to Shepherd Ching.
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.
Posted on 2/1/08 6:09 AM.
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.
Posted on 2/1/08 6:24 AM in reply to Jorge Ferrer.
I like your new picture Bruno emoticon
Posted on 2/1/08 10:32 AM in reply to Bruno Farache.
Posted on 2/5/08 3:56 AM in reply to Bruno Farache.
How can I Remove "Front page" Heading in liferay Wiki Portlet
Posted on 11/4/10 4:55 AM.