|
Cookbook /
ViewDiffSummary: Compare arbitrary revisions and view a particular version.
Version: 2011-05-13
Prerequisites: pmwiki 2.2.11+
Status: Beta
License: GPL2
Maintainer: Diafygi
Discussion: ViewDiff-Talk?
Questions
DescriptionViewDiff is an action that creates a rendering of a page that based on a certain time in its history. It will also display the changes made to a page based on a second time. InstallationTo enable ViewDiff, save viewdiff.phpΔ in your cookbook folder, and include the following line in your config.php: include_once("$FarmD/cookbook/viewdiff.php");
UseBy default ViewDiff creates a form on the History page where you can select two edits to compare. You can turn this option off by setting To use ViewDiff directly, simply call the action 'viewdiff' in your page url. This will display a temporary rendering of the current page at the current time. http://example.com/wiki/Main/Home?action=viewdiff
You can also specify a time by including its unix timestamp in the url. http://example.com/wiki/Main/Home?action=viewdiff&time=1122334455
You can compare two edits by including two times in the url separated by a colon. http://example.com/wiki/Main/Home?action=viewdiff&time=1122334455:2233445566
This action also accepts PmWiki formated Edit IDs http://example.com/wiki/Main/Home?action=viewdiff&time=diff:1122334455:2233445566:
or
http://example.com/wiki/Main/Home?action=viewdiff&time=diff:1122334455:2233445566:minor
You can also have two times in two different url variables http://example.com/wiki/Main/Home?action=viewdiff&time1=1122334455&time2=2233445566
or
http://example.com/wiki/Main/Home?action=viewdiff&time1=diff:1122334455:2233445566:minor&time2=diff:3344556677:4455667788:minor
(This takes the times 1122334455 and 3344556677)
NOTE: This recipe does not revert CustomizationYou can add a link to ViewDiff from your PmWiki History page (on each edit's timestamp) by adding the following line of code to your config.php file: $DiffStartFmt = "<div class='diffbox'><div class='difftime'>
<div class='diffradio'>
<input type='radio' id='time1:\$DiffId' name='time2' value='\$DiffId' onclick=\"hideradios()\" /> </div>
<div class='diffradio'>
<input type='radio' id='time2:\$DiffId' name='time1' value='\$DiffId' onclick=\"hideradios()\" /> </div>
<a href='{\$PageUrl}?action=viewdiff&time=\$DiffId'>\$DiffTime</a>
\$[by] <span class='diffauthor' title='\$DiffHost'>\$DiffAuthor</span> - \$DiffChangeSum</div>";
You can also customize the output of ViewDiff by changing the following variables from their defaults:
Release Notes
Road Map
See AlsoPITS:
Mailing List:
Recipes:
ContributorsCommentsThanks for this handy recipe! I noticed and fixed a small typo on line 79: $DiffStartFmt = "...";
should have been SDV($DiffStartFmt, "...");.
I also changed the $DiffStartFmt contents in the Customization section (above) to match the default (but with a link). Thanks again! rikblok? June 07, 2009, at 03:15 PM
Thanks from me too; very handy feature that should go into core History feature. Only problem I had was the top Compare button and radio buttons were not right-aligned like the rest so I changed the CSS and remove div around the button. .diffradiotitle { text-align:right; height:1.5em; clear:both; }
<input type='submit' value='\$[Compare]' />
If I use the comparison form and set my own value for $DiffStartFmt in the config file, my specified format has no effect. It would be nice if I could specify my own fmt (see PITS:00400: for how to prevent the IP address from being seen by all users) to enhance privacy. Will a future release allow me to both use the comparison form and to specify $DiffStartFmt? - RandyB May 11, 2011, at 04:22 PM
Thanks for adding that capability, and for the ready-to-plug-in PHP code! - RandyB May 13, 2011, at 10:41 AM See discussion at ViewDiff-Talk? User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |