2 rcs_id('$Id: pageinfo.php,v 1.11 2001-09-18 19:16:23 dairiki Exp $');
3 require_once('lib/Template.php');
5 global $datetimeformat;
7 // Display the internal structure of a page.
8 $pagename = $request->getArg('pagename');
9 $page = $dbi->getPage($pagename);
11 $rows[] = Element('tr',
13 . Element('th', 'Version') . "\n"
14 . Element('th', 'Newer') . "\n"
15 . Element('th', 'Older') . "\n"
16 . Element('th', 'Created') . "\n"
17 . Element('th', 'Summary') . "\n"
18 . Element('th', 'Author') . "\n"
21 // Get all versions of a page, then iterate over them to make version list
22 $iter = $page->getAllRevisions();
24 $last_author_id = false;
26 function bold_if($cond, $text) {
27 return (bool)$cond ? QElement('b', $text) : htmlspecialchars($text);
31 while ($rev = $iter->next()) {
32 $version = $rev->getVersion();
34 $is_major_edit = ! $rev->get('is_minor_edit');
36 $cols[] = Element('td', array('align' => 'right'),
37 Element('a', array('href'
39 array('version' => $version))),
40 bold_if($is_major_edit, $version)));
43 $cols[] = Element('td', array('align' => 'center'),
44 QElement('input', array('type' => 'radio',
47 'checked' => $i == 0)));
49 $cols[] = Element('td', array('align' => 'center'),
50 QElement('input', array('type' => 'radio',
53 'checked' => $i++ == 1)));
55 $cols[] = QElement('td', array('align' => 'right'),
56 strftime($datetimeformat, $rev->get('mtime'))
60 $cols[] = Element('td', bold_if($is_major_edit, $rev->get('summary')));
62 $author_id = $rev->get('author_id');
63 $cols[] = Element('td', bold_if($author_id !== $last_author_id,
64 $rev->get('author')));
65 $last_author_id = $author_id;
66 $rows[] = Element('tr', "\n" . join("\n", $cols) . "\n");
70 . Element('table', join("\n", $rows)) . "\n"
71 . Element('input', array('type' => 'hidden',
73 'value' => 'diff')) . "\n"
74 . Element('input', array('type' => 'submit', 'value' => 'Run Diff')) . "\n");
76 $formargs['action'] = USE_PATH_INFO ? WikiURL($pagename) : SCRIPT_NAME;
77 $formargs['method'] = 'post';
80 htmlspecialchars(gettext("Currently archived versions of"))
82 . LinkExistingWikiWord($pagename));
83 $html .= Element('form', $formargs, $table);
85 echo GeneratePage('MESSAGE', $html, gettext("Revision History: ") . $pagename);
92 // c-hanging-comment-ender-p: nil
93 // indent-tabs-mode: nil