b24e7e57566e7774ffa9f3ce4d65e4e53dc53abe
[atutor.git] / mods / wiki / plugins / action / info_qdiff.php
1 <?php
2
3 /*
4   provides the 'quickdiff' through multiple (all) page versions,
5   available from the info/ page; depends upon 'stupid diff' module
6 */
7
8 $ewiki_plugins["action"]["qdiff"] = "ewiki_action_info_qdiff";
9 $ewiki_config["action_links"]["summary"]["qdiff"] = "quick diff (history overview)";
10
11
12 function ewiki_action_info_qdiff($id, &$data, $action) {
13
14    $CLK = "%c";
15    $o = ewiki_make_title($id, "history of '$id'", 2);
16
17    #-- walk through versions
18    $prev = (array)$data;
19    $ver = $data["version"] + 1;
20    while ((--$ver) >= 2) {
21    
22       #-- get
23       if ($d = ewiki_db::GET($id, $ver-1)) {
24          $curr = $prev;
25          $prev = $d;
26          $d = NULL;
27       }
28       else {
29          continue;
30       }
31       
32       #-- info header
33       $o .= '<table border="1">' . "\n" . '<tr class="qdiff-header"><td>'
34          .  '<b><a href="' . ewiki_script("", $id, "version=$ver") . "\">version $ver</a></b>"
35          . '</td><td>' . ewiki_author_html($curr["author"])
36          . '</td><td>' . strftime($CLK, $curr["lastmodified"])
37          . "</td></tr>\n";
38
39       #-- diff part
40       $diff = ewiki_stupid_diff($curr["content"], $prev["content"], $show_unchanged=0, $magic_notes=1);
41       $o .= '<td colspan="3">' . $diff;
42       $o .= "\n</td></tr>\n</table>\n<br />\n";
43
44    }
45
46    return($o);   
47 }
48
49
50 ?>