about standards, webdesign, usability and open source

NP_Revision 0.5 0.6

A complete revisioning system for Nucleus CMS stories

Thanks to my job I regularly come into contact with code management systems like CVS and Subversion. These tools basically offer a repository where different revisions of source code files are stored. Once a change is made to any of those source code files that particular file is send back to the repository, but unlike a regular file system, every other older version of that particular file is still available and thanks to a build in diff algorithm it is easy to see what changes were made to a particular file over time.

Last week I suddenly wondered if it would be possible to use a similar system for my weblog. Normally, everytime I make a change, the older version will be lost forever. What I wanted is that if I make a change to a story a new revision of that story will be created and that revision will be the default revision that is shown to visitors, but all the other revisions must still be available. I want to be able to quickly and easily see the changes between revisions and I want to be able to revert back to an older revision in case I do not like one of the changes I have made.

The breakthrough was the discovery of a diff algorithm in PHP. The algorithm was created for phpWiki and adapted by the people at MediaWiki. It was perfect for the job I wanted it to perform, although it was an important part, it was only a small part of the plugin I now was going to write. That same day I started writing the code for the implementation of the actual revision system. The code is now ready, is called NP_Revision and will be released as a beta version.

What does it do exactly?

Every time you make a change to a story it will store that change and assign a revision number to that change. For example, the first draft you create for a story will have the revision number of 0.1, the next time you make a change the number will be increased to 0.2, then to 0.3 and so on. If you publish your draft the revision number will be increased to 1.0 and once again, every additional change will increase the revision number. The beauty of this system is that every older revision will still be available.

Take for example the story PearPC needs help on my weblog. It has to following URL: http://www.rakaz.nl/nucleus/item/60. This URL will take you to the last revision – revision 1.2 – of that story. This means there are at least two other revisions available, revision 1.1 and 1.0. To access these revisions you can simply append something to the URL. If you have FancyURLs enabled, like I have, you can simply append /revision/1.1:


If you are using regular URLs you must append a parameter called rev:


If you visit one of the URLs above you will notice a red warning message at the top. It basically tells the visitor that the page they are seeing is not the latest revision. This warning is shown by default on all older revisions, but it can also be customized or even disabled in the admin settings of the plugin.

The warning message also contains a link to a diff between the revision you are currently seeing and the latest revision. If you look at the diff you will quickly see the changes that were made between these revisions.

Revision administration

The only place in the Admin area where you will notice the Revision plugin is on the Edit Item page. Every time you make a change to an item you can leave a little comment in the ‘Comment for next change’ field, describing the change you are making. This comment is shown together with the diffs and in the revision overview on the Edit Item page. Leaving comments is not a requirement, but it will help you keep track of the changes you made.

Just below the comment field is an overview of all revisions that are available. For each revision you can see the revision number, the date on which that revision was created and the comment you left for that change. It is also possible to revert back to an older revision or see a diff between two revisions.

If you revert back to an older revision, you are basically creating a new revision which will change back all options and fields to the state they had in the earlier revision. All changes will be reverted, including the title, the body text, the extended text, but also whether or not comments are allowed. If the revision you are reverting to is still a draft, the story will become a draft again. This means that the story will not be visible to visitors anymore.

Templates and Skins

This plugin offers several variables you can use in your templates and skins.

Insert the revision number of the revision that is shown at this moment. This is the last revision by default, but if the user is viewing an older revision that revision number is shown.


8 Responses to “NP_Revision 0.5 0.6”

  1. GregK wrote on April 18th, 2005 at 7:09 pm

    ooh, so this is the new plugin you mentioned the other day :)

    Nice! ;)

    What is the best way to contact you?

  2. erik wrote on April 18th, 2005 at 8:15 pm

    Very interesting plugin. I can see many possible uses for this. I notice also that when you revise, it gets posted in the RSS feed, so readers know there’s a revised piece, even it that’ s not immediately apparent. I haven’t tried it yet on my own site, but i might.

  3. Björn Hallberg wrote on April 20th, 2005 at 3:38 pm

    Totally brilliant concept! Will try that out asap. It takes one neatfreak to do something like this and another one to appreciate the idea :-)

  4. rakaz wrote on April 20th, 2005 at 4:15 pm

    GregK: niels (dot) leenheer (at) gmail (dot) com

  5. M. Querling wrote on January 14th, 2006 at 10:32 pm

    I have installed your plug in. How can new users add a new block?

    Thank Marc

  6. M. Querling wrote on January 14th, 2006 at 10:36 pm

    I have installed your plug in. How can new users add a new block?

    Thank Marc

  7. jammo wrote on April 7th, 2006 at 9:17 am

    An amazingly cool plugin that allows me to keep articles/blawgs that I have editted.

    thank you for a great new plugin!

  8. Elkana wrote on May 3rd, 2007 at 2:22 pm

    Hey Rakaz!
    It’s a great plugin! But I have a little question. I want to make the links (< %Revision(currenturl)%>) clickable. How do I have to do that? Could you answer me in an email?
    Many greetz from Elkana.nl