]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/default/templates/info.tmpl
Added a count of the number of words on the page for Reini. This seems to work, even...
[SourceForge/phpwiki.git] / themes / default / templates / info.tmpl
1 <?php // -*-html-*- ?>
2 <!-- $Id: info.tmpl,v 1.6 2002-02-23 01:51:55 carstenklapp Exp $ -->
3 <?php
4
5 $modifed = $Theme->formatDateTime($revision->get('mtime'));
6
7 $author = $revision->get('author');
8 global $WikiNameRegexp;
9 $dbi = $request->getDbh();
10 if (preg_match("/^$WikiNameRegexp\$/", $author) && $dbi->isWikiPage($author))
11     $author = WikiLink($author);
12
13 $authorId = $revision->get('author_id');
14 $version = $revision->getVersion();
15 $hits = $page->get('hits');
16
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") . ")"));
22 }
23
24 /* better way to do this? */
25 $data = &$revision->_data;
26 $bytes = strlen(&$data['%content']);
27 if ($bytes < 1024 )
28     $size = fmt("%s bytes", $bytes);
29 else {
30     $kb = round($bytes / 1024, 1);
31     $size = fmt("%s Kb (%s bytes)", $kb, $bytes);
32 }
33 // Count words
34 preg_match_all('/\\w+\\W*/', &$data['%content'], $whitespacematches);
35 if (1 == $c = count_all($whitespacematches))
36   $wordcount = fmt("1 word");
37 else
38   $wordcount = fmt("%s words", $c);
39
40
41 $markupVersion = ($markupVersion = $revision->get('markup'))
42                ? fmt("Version %s", $markupVersion)
43                : _("Original (1.2 or 1.0)");
44
45 $summary = HTML::textarea(array('name' => 'summary',
46                                 'class' => 'summary',
47                                 /* use fixed dimensions? */
48                                 'rows' => $request->getPref('editHeight')/4,
49                                 'cols' => $request->getPref('editWidth')/2,
50                                 'readonly' => 'readonly',
51                                 'wrap' => 'virtual'), /* for Netscape 4 */
52                           $revision->get('summary'));
53
54 if ($is_current = $revision->isCurrent()) {
55
56     $LOCKED_CB = HTML::input(array('type' => 'checkbox',
57                                    'name' => 'edit[locked]',
58                                    'disabled' => !$user->isadmin(),
59                                    'checked'  => $page->get('locked')));
60
61     // Not sure if I want to keep this... --Carsten
62     if ($user->isadmin()) {
63         $lockunlock = $page->get('locked') ? 'unlock' : 'lock';
64         $clickcheckbUrl = WikiURL($revision, array('action' => $lockunlock));
65         $clickcheckb = "location.href='$clickcheckbUrl'";
66
67         $LOCKED_CB->setAttr('onclick', $clickcheckb);
68     }
69
70     $label['date'] = _("Last Modified:");
71     $label['author'] = _("Last Author:");
72     $label['summary'] = _("Last Summary:");
73
74 } else {
75     $label['date'] = _("Saved on:");
76     $label['author'] = _("Author:");
77     $label['summary'] = _("Summary:");
78 }
79
80 $tableSummary = fmt("Statistics about %s.", $page->getName());
81
82 ?>
83
84 <!-- FIXME: move table formatting to css -->
85 <table summary="<?= $tableSummary ?>" class="pageinfo"
86        border="0" cellspacing="0" cellpadding="3">
87
88 <?php if (!$is_current) { ?>
89   <tr>
90     <td align="right" class="pageinfo"><?=_("Supplanted on:")?></td>
91     <td><?= $Theme->formatDateTime($revision->get('_supplanted')) ?></td>
92   </tr>
93 <?php } ?>
94
95   <tr>
96     <td align="right" nowrap="nowrap" class="pageinfo"><?= $label['date'] ?></td>
97     <td><?= $modifed ?><?= $minor_flag ?></td>
98   </tr><tr>
99     <td align="right" class="pageinfo"><?= $label['author'] ?></td>
100     <td><?= $author ?> <span class="pageinfo-authorid">(<?= $authorId ?>)</span></td>
101   </tr><tr>
102     <td align="right" class="pageinfo"><?=_("Page Version:")?></td>
103     <td><?= $version ?></td>
104   </tr><tr>
105     <td align="right" class="pageinfo"><?=_("Markup:")?></td>
106     <td><?= $markupVersion ?></td>
107   </tr><tr>
108     <td align="right" class="pageinfo"><?=_("Size:")?></td>
109     <td><?= $wordcount ?>, <?= $size ?></td>
110
111 <?php if ($is_current) { ?>
112   </tr><tr>
113     <td align="right" class="pageinfo"><?= _("Hits:") ?></td>
114     <td><?= $hits ?></td>
115 <?php } ?>
116
117   </tr><tr>
118     <td align="right" valign="top" class="pageinfo"><?= $label['summary'] ?></td>
119     <td><?= $summary ?></td>
120
121 <?php if ($is_current) { ?>
122   </tr><tr>
123     <td align="right"><?= $LOCKED_CB ?></td>
124     <td class="pageinfo"><?=_("Locked")?></td>
125 <?php } ?>
126
127   </tr>
128 </table>