]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/default/templates/info.tmpl
Internal change: Fix PHP Warning: Call-time pass-by-reference has been deprecated
[SourceForge/phpwiki.git] / themes / default / templates / info.tmpl
1 <?php // -*-html-*- ?>
2 <!-- $Id: info.tmpl,v 1.15 2003-12-11 19:38:29 carstenklapp Exp $ -->
3 <?php
4
5 $modifed = $Theme->formatDateTime($revision->get('mtime'));
6
7 global $WikiNameRegexp;
8 $dbi = $request->getDbh();
9 $author = $revision->get('author');
10 $authorLink = $author;
11 if (preg_match("/^$WikiNameRegexp\$/", $author) && $dbi->isWikiPage($author))
12     $authorLink = WikiLink($author);
13
14 $authorId = $revision->get('author_id');
15 $version = $revision->getVersion();
16 $hits = $page->get('hits');
17
18 $is_minor_edit = $revision->get('is_minor_edit') ? _("minor edit") : false;
19 if ($minor_flag = $is_minor_edit) {
20     $minor_flag = HTML(" ",
21                        HTML::span(array('class' => 'pageinfo-minoredit'),
22                                   "(" . _("minor edit") . ")"));
23 }
24
25 /* better way to do this? */
26 $bytes = strlen($revision->_data['%content']);
27 $size = ByteFormatter($bytes, /* $longformat = */true);
28 // Count words
29 preg_match_all('/\\w+\\W*/', $revision->_data['%content'], $whitespacematches);
30 if (1 == $c = count_all($whitespacematches))
31   $wordcount = fmt("1 word");
32 else
33   $wordcount = fmt("%s words", $c);
34
35
36 $markupVersion = ($markupVersion = $revision->get('markup'))
37                ? fmt("Version %s", $markupVersion)
38                : _("Original (1.2 or 1.0)");
39
40 $summary = HTML::textarea(array('name' => 'summary',
41                                 'class' => 'summary',
42                                 /* use fixed dimensions? */
43                                 'rows' => $request->getPref('editHeight')/4,
44                                 'cols' => $request->getPref('editWidth')/2,
45                                 'readonly' => 'readonly',
46                                 'wrap' => 'virtual'), /* for Netscape 4 */
47                           $revision->get('summary'));
48
49 if ($is_current = $revision->isCurrent()) {
50
51     $LOCKED_CB = HTML::input(array('type' => 'checkbox',
52                                    'name' => 'edit[locked]',
53                                    'disabled' => !$user->isadmin(),
54                                    'checked'  => $page->get('locked')));
55
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
62         $LOCKED_CB->setAttr('onclick', $clickcheckb);
63     }
64
65     $label['date'] = _("Last Modified:");
66     $label['author'] = _("Last Author:");
67     $label['summary'] = _("Last Summary:");
68
69 } else {
70     $label['date'] = _("Saved on:");
71     $label['author'] = _("Author:");
72     $label['summary'] = _("Summary:");
73 }
74
75 $tableSummary = fmt("Statistics about %s.", $page->getName());
76 $Sep = $Theme->getButtonSeparator();
77
78 ?>
79
80 <!-- FIXME: move table formatting to css -->
81 <table summary="<?= $tableSummary ?>" class="pageinfo"
82        border="0" cellspacing="0" cellpadding="3">
83
84 <?php if (!$is_current) { ?>
85   <tr>
86     <td align="right" class="pageinfo"><?=_("Supplanted on:")?></td>
87     <td><?= $Theme->formatDateTime($revision->get('_supplanted')) ?></td>
88   </tr>
89 <?php } ?>
90
91   <tr>
92     <td align="right" nowrap="nowrap" class="pageinfo"><?= $label['date'] ?></td>
93     <td><?= $modifed ?><?= $minor_flag ?></td>
94   </tr>
95   <tr>
96     <td align="right" class="pageinfo"><?= $label['author'] ?></td>
97     <td><?= $authorLink ?>
98       <?php if (! ($author == $authorId)) { ?>
99         <span class="pageinfo-authorid">(<?= $authorId ?>)</span>
100       <?php } ?></td>
101   </tr>
102   <tr>
103     <td align="right" class="pageinfo"><?=_("Page Version:")?></td>
104     <td><?= $version ?></td>
105   </tr>
106   <tr>
107     <td align="right" class="pageinfo"><?=_("Markup:")?></td>
108     <td><?= $markupVersion ?></td>
109   </tr>
110   <tr>
111     <td align="right" class="pageinfo"><?=_("Size:")?></td>
112     <td><?= $wordcount ?>, <?= $size ?></td>
113   </tr>
114 <?php if ($is_current) { ?>
115   <tr>
116     <td align="right" class="pageinfo"><?= _("Hits:") ?></td>
117     <td><?= $hits ?></td>
118   </tr>
119 <?php } ?>
120   <tr>
121     <td align="right" valign="top" class="pageinfo"><?= $label['summary'] ?></td>
122     <td><?= $summary ?></td>
123   </tr>
124 <?php if ($is_current) { ?>
125   <tr>
126     <td align="right"><?= $LOCKED_CB ?></td>
127     <td class="pageinfo"><?=_("Locked")?></td>
128   </tr>
129 <?php } ?>
130
131 <?php // determine page type
132 if (HOME_PAGE == $page->getName()) {
133     $pagetype []= sprintf('%s %s', WIKI_NAME, _("home page"));
134 }
135 if ($page->isUserPage($include_empty=true)) {
136     $pagetype []= _("User page");
137 }
138 if (@$request->isActionPage($page->getName())) {
139     $pagetype []= _("Action page");
140 }
141 if ($page->get('pagetype') == 'wikiblog') {
142     $pagetype []= _("Blog page");
143 }
144 if ($page->getName() == _("InterWikiMap")) {
145     $pagetype []= _("InterWikiMap");
146 }
147 if (isSubPage($page->getName())) {
148     $pagetype []= _("Subpage");
149 } ?>
150
151 <?php if (!empty($pagetype)) { $pagetype = implode(", ", $pagetype); ?>
152   <tr>
153     <td align="right" class="pageinfo"><?=_("Page Type:")?></td>
154     <td align="left"><?=$pagetype?></td>
155   </tr>
156 <?php } ?>
157
158 </table>
159
160 <?php
161 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -                         
162 // $Log: not supported by cvs2svn $
163 // Revision 1.14  2003/11/29 20:13:38  carstenklapp
164 // Internal change: Refactored ByteFormatter code into a new function in
165 // stdlib (now used by PageList too).
166 //
167 // Revision 1.13  2003/02/21 04:24:48  dairiki
168 // Fix <td> </td> nesting. (Was generating invalid HTML.)
169 //
170 // Revision 1.12  2003/01/11 22:54:28  carstenklapp
171 // Added Page type field displayed for special pages.
172 //
173 ?>