[Pmwiki-users] commenting / time-line wiki

J. Meijer commentgg
Mon Jun 14 17:37:44 CDT 2004


See my other post: commenting / hierarchy case-study.

Of course I would like to review a commented page along a time-line, with
all comments correct.

   pmwiki.php?pagename=Project.Work&date=30-5-4

would give me the page at it was on may 30th.

Now that is a useful property because of its uniqueness. Highly valuable in
an internal employee communication system. Something we will simply come to
expect of an ''information system'': to render the events that make up
history. A good wiki should be browseable as on a specified date, as long as
that date lies in the past ;-)

Of a wiki it is something to be expected. Or else it is not a wiki. I guess
most wiki just are not a wiki yet.

Looking at the pmwiki code it seems to be a one-liner.

-jm




ps I felt brave and I found a one-liner. Make sure pmwiki.php ReadPage()
ends this way:
  ...
  if ($restore && $PatchFunction) $page['text'] =
    $PatchFunction($page,$restore);//JM
  return $page;
}
Don't forget to add $restore and $PatchFunction to the list of global vars!

Modify this line in HandleEdit():
  if ($restore && $PatchFunction) { $text =
     $PatchFunction($page,$restore); }
to read:
  if ($restore && $PatchFunction) $text = $page['text']; //JM

Now you can append &diff:1085871600 to the url to get the page as it was at
timestamp 1085871600 (30th of may 2004). Apparently all pages making up a
page are affected. Though the code is quite rigorous I didn't observe any
adverse side-effects on my *highly* undesirable IIS installation.

A better interface
The format above is 'kind of unhandy' so you'll want to add the code below
to your config.php, it will allow you to append &date=30-5-2004 (or
&date=30-5-4) to get the same result. It will also make the date show up in
the title and make it persistent across hyperlinks.

# code to allow to view wiki at specified date ?J. Meijer.
# usage: append f.e. &date=30-5-4 to your url.
function TimeLine() {
  global $WikiTitle;
  $date=$_REQUEST['date'];
  $dates=explode('-',$date);
  if (count($dates)===3) {
    output_add_rewrite_var('date', $date);
    $WikiTitle="$date: $WikiTitle";
    return 'diff:'.mktime(0,0,0,$dates[1],$dates[0],$dates[2]);
  }
}
if (!$restore) $restore=TimeLine();
# what a messy thing those PHP time-functions!


This code in its current state is a good start, proof of concept, but it is
still a hack for Pm to scrutinize. I'd like to see its improved version
included, even something as basic as just the one-liner required to make it
work. Please vote for it.

Happy browsing.








More information about the pmwiki-users mailing list