2 if (empty($revision)) $revision = $page->getCurrentRevision(false);
3 $modifed = $WikiTheme->formatDateTime($revision->get('mtime'));
5 $author = $revision->get('author');
6 global $WikiNameRegexp;
7 $dbi = $request->getDbh();
8 $author = $revision->get('author');
10 if (preg_match("/^$WikiNameRegexp\$/", $author) && $dbi->isWikiPage($author))
11 $authorLink = WikiLink($author);
13 $authorId = $revision->get('author_id');
14 $version = $revision->getVersion();
15 $hits = $page->get('hits');
17 $is_minor_edit = $revision->get('is_minor_edit') ? _("minor edit") : false;
18 if ($minor_flag = $is_minor_edit) {
19 $minor_flag = HTML(" ",
20 HTML::span(array('class' => 'pageinfo-minoredit'),
21 "(" . _("minor edit") . ")"));
24 /* better way to do this? */
25 $bytes = strlen($revision->_data['%content']);
27 $size = fmt("%s bytes", $bytes);
29 $kb = round($bytes / 1024, 1);
30 $size = fmt("%s KiB (%s bytes)", $kb, $bytes);
33 preg_match_all('/\\w+\\W*/', $revision->_data['%content'], $whitespacematches);
34 if (1 == $c = count_all($whitespacematches))
35 $wordcount = fmt("1 word");
37 $wordcount = fmt("%s words", $c);
40 $summary = HTML::textarea(array('name' => 'summary',
42 /* use fixed dimensions? */
43 'rows' => intval($request->getPref('editHeight')/4),
44 'cols' => intval($request->getPref('editWidth')/2),
45 'readonly' => 'readonly',
47 $revision->get('summary'));
49 if ($is_current = $revision->isCurrent()) {
51 $LOCKED_CB = HTML::input(array('type' => 'checkbox',
52 'name' => 'edit[locked]',
53 'disabled' => !$user->isadmin(),
54 'checked' => $page->get('locked')));
56 // Not sure if I want to keep this... --Carsten
57 if ($user->isAdmin()) {
58 $lockunlock = $page->get('locked') ? 'unlock' : 'lock';
59 $clickcheckbUrl = WikiURL($revision, array('action' => $lockunlock));
60 $clickcheckb = "location.href='$clickcheckbUrl'";
61 $LOCKED_CB->setAttr('onclick', $clickcheckb);
64 $label['date'] = _("Last Modified") . _(":");
65 $label['author'] = _("Last Author") . _(":");
66 $label['summary'] = _("Last Summary") . _(":");
69 $label['date'] = _("Saved on") . _(":");
70 $label['author'] = _("Author") . _(":");
71 $label['summary'] = _("Summary") . _(":");
74 $tableSummary = fmt("Statistics about %s.", $page->getName());
76 $perm_tree = pagePermissions($page->getName());
77 list($type, $perm) = pagePermissionsAcl($perm_tree[0], $perm_tree);
78 if ($type == 'inherited') {
79 $type = sprintf(_("page permission inherited from %s"), $perm_tree[1][0]);
80 } elseif ($type == 'page') {
81 $type = _("individual page permission");
82 } elseif ($type == 'default') {
83 $type = _("default page permission");
87 <table class="pageinfo">
89 <?php if (!$is_current) { ?>
91 <td class="align-right pageinfo"><?php echo _("Supplanted on") . _(":") ?></td>
92 <td><?php echo $WikiTheme->formatDateTime($revision->get('_supplanted')) ?></td>
97 <td class="align-right nowrap pageinfo"><?php echo $label['date'] ?></td>
98 <td><?php echo $modifed ?><?php echo $minor_flag ?></td>
101 <td class="align-right pageinfo"><?php echo $label['author'] ?></td>
102 <td><?php echo $authorLink ?>
103 <?php if (! ($author == $authorId)) { ?>
104 <span class="pageinfo-authorid">(<?php echo $authorId ?>)</span>
108 <td class="align-right pageinfo"><?php echo _("Page Version") . _(":") ?></td>
109 <td><?php echo $version ?></td>
112 <td class="align-right pageinfo"><?php echo _("Size") . _(":") ?></td>
113 <td><?php echo $wordcount ?>, <?php echo $size ?></td>
115 <?php if ($is_current) { ?>
117 <td class="align-right pageinfo"><?php echo _("Hits") . _(":") ?></td>
118 <td><?php echo $hits ?></td>
122 <td class="align-right nowrap top pageinfo"><?php echo $label['summary'] ?></td>
123 <td><?php echo $summary ?></td>
125 <?php if ($is_current) { ?>
127 <td class="align-right"><?php echo $LOCKED_CB ?></td>
128 <td class="pageinfo"><?php echo _("Locked")?></td>
131 <td class="align-right pageinfo"><?php echo _("ACL type") . _(":") ?></td>
132 <td><?php echo $type ?></td>
135 <td class="align-right top pageinfo"><?php echo _("ACL") . _(":") ?></td>
136 <td><?php echo $perm->asAclLines() ?></td>
140 <?php // determine page type
141 if (HOME_PAGE == $page->getName()) {
142 $pagetype []= sprintf('%s %s', WIKI_NAME, _("Home Page"));
144 if (0 && $page->isUserPage($include_empty=true)) {
145 $pagetype []= _("User page");
147 if (isActionPage($page->getName())) {
148 $pagetype []= _("Action Page");
150 if ($page->get('pagetype') == 'wikiblog') {
151 $pagetype []= _("Blog page");
153 if ($page->getName() == _("InterWikiMap")) {
154 $pagetype []= _("InterWikiMap");
156 if (0 and isSubPage($page->getName())) {
157 $pagetype []= _("Subpage");
160 <?php if (!empty($pagetype)) { $pagetype = implode(", ", $pagetype); ?>
162 <td class="align-right pageinfo"><?php echo _("Page Type") . _(":") ?></td>
163 <td><?php echo $pagetype?></td>
169 <div id="actionbuttons">
170 <?php echo Button("viewsource", _("View Source")) ?>
171 <?php echo $SEP?><?php echo Button("PageHistory", _("PageHistory")) ?>
172 <?php echo $SEP?><?php echo Button("AuthorHistory", _("AuthorHistory")) ?>
173 <?php echo $SEP?><?php echo Button("Diff") ?>
174 <?php echo $SEP?><?php echo Button(array('action'=>'diff','previous' => 'minor'),_("Diff previous Revision"),$page->getName()) ?>
175 <?php echo $SEP?><?php echo Button(array('action'=>'diff','previous' => 'author'),_("Diff previous Author"),$page->getName()) ?>
176 <?php if ((defined('DEBUG') && DEBUG) || $user->isAdmin()) { ?>
177 <!-- Buttons really only for debugging -->
178 <?php echo $SEP?><?php echo Button("DebugInfo", _("DebugInfo")) ?>
180 $PurgeCache = Button(array('nocache' => 'purge'),
181 _("PurgeHtmlCache"), $page->getName());
182 $PurgeCache->addTooltip(_("Purge HTML cache for this page. Regenerate from WikiMarkup when next accessed."));
184 <?php echo $SEP?><?php echo $PurgeCache ?>
186 <!-- End debugging buttons -->