]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/MonoBook/templates/info.tmpl
new MonoBook theme (copied from mediawiki)
[SourceForge/phpwiki.git] / themes / MonoBook / templates / info.tmpl
1 <?php // -*-php-*- ?>
2 <!-- $Id: info.tmpl,v 1.1 2004-06-11 09:01:51 rurban 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 $author = $revision->get('author');
11 $authorLink = $author;
12 if (preg_match("/^$WikiNameRegexp\$/", $author) && $dbi->isWikiPage($author))
13     $authorLink = WikiLink($author);
14
15 $authorId = $revision->get('author_id');
16 $version = $revision->getVersion();
17 $hits = $page->get('hits');
18
19 $is_minor_edit = $revision->get('is_minor_edit') ? _("minor edit") : false;
20 if ($minor_flag = $is_minor_edit) {
21     $minor_flag = HTML(" ",
22                        HTML::span(array('class' => 'pageinfo-minoredit'),
23                                   "(" . _("minor edit") . ")"));
24 }
25
26 /* better way to do this? */
27 $bytes = strlen($revision->_data['%content']);
28 if ($bytes < 1024 )
29     $size = fmt("%s bytes", $bytes);
30 else {
31     $kb = round($bytes / 1024, 1);
32     $size = fmt("%s Kb (%s bytes)", $kb, $bytes);
33 }
34 // Count words
35 preg_match_all('/\\w+\\W*/', $revision->_data['%content'], $whitespacematches);
36 if (1 == $c = count_all($whitespacematches))
37   $wordcount = fmt("1 word");
38 else
39   $wordcount = fmt("%s words", $c);
40
41
42 $markupVersion = ($markupVersion = $revision->get('markup'))
43                ? fmt("Version %s", $markupVersion)
44                : _("Original (1.2 or 1.0)");
45
46 $summary = HTML::textarea(array('name' => 'summary',
47                                 'class' => 'summary',
48                                 /* use fixed dimensions? */
49                                 'rows' => $request->getPref('editHeight')/4,
50                                 'cols' => $request->getPref('editWidth')/2,
51                                 'readonly' => 'readonly',
52                                 'wrap' => 'virtual'), /* for Netscape 4 */
53                           $revision->get('summary'));
54
55 if ($is_current = $revision->isCurrent()) {
56
57     $LOCKED_CB = HTML::input(array('type' => 'checkbox',
58                                    'name' => 'edit[locked]',
59                                    'disabled' => !$user->isadmin(),
60                                    'checked'  => $page->get('locked')));
61
62     // Not sure if I want to keep this... --Carsten
63     if ($user->isadmin()) {
64         $lockunlock = $page->get('locked') ? 'unlock' : 'lock';
65         $clickcheckbUrl = WikiURL($revision, array('action' => $lockunlock));
66         $clickcheckb = "location.href='$clickcheckbUrl'";
67
68         $LOCKED_CB->setAttr('onclick', $clickcheckb);
69     }
70
71     $label['date'] = _("Last Modified").':';
72     $label['author'] = _("Last Author").':';
73     $label['summary'] = _("Last Summary").':';
74
75 } else {
76     $label['date'] = _("Saved on:");
77     $label['author'] = _("Author").':';
78     $label['summary'] = _("Summary").':';
79 }
80
81 $tableSummary = fmt("Statistics about %s.", $page->getName());
82 $Sep = $Theme->getButtonSeparator();
83
84 ?>
85
86 <!-- FIXME: move table formatting to css -->
87 <table summary="<?= $tableSummary ?>" class="pageinfo"
88        border="0" cellspacing="0" cellpadding="3">
89
90 <?php if (!$is_current) { ?>
91   <tr>
92     <td align="right" class="pageinfo"><?=_("Supplanted on:")?></td>
93     <td><?= $Theme->formatDateTime($revision->get('_supplanted')) ?></td>
94   </tr>
95 <?php } ?>
96
97   <tr>
98     <td align="right" nowrap="nowrap" class="pageinfo"><?= $label['date'] ?></td>
99     <td><?= $modifed ?><?= $minor_flag ?></td>
100   </tr>
101   <tr>
102     <td align="right" class="pageinfo"><?= $label['author'] ?></td>
103     <td><?= $authorLink ?>
104       <?php if (! ($author == $authorId)) { ?>
105         <span class="pageinfo-authorid">(<?= $authorId ?>)</span>
106       <?php } ?></td>
107   </tr>
108   <tr>
109     <td align="right" class="pageinfo"><?=_("Page Version:")?></td>
110     <td><?= $version ?></td>
111   </tr>
112   <tr>
113     <td align="right" class="pageinfo"><?=_("Markup:")?></td>
114     <td><?= $markupVersion ?></td>
115   </tr>
116   <tr>
117     <td align="right" class="pageinfo"><?=_("Size:")?></td>
118     <td><?= $wordcount ?>, <?= $size ?></td>
119   </tr>
120 <?php if ($is_current) { ?>
121   <tr>
122     <td align="right" class="pageinfo"><?= _("Hits:") ?></td>
123     <td><?= $hits ?></td>
124   </tr>
125 <?php } ?>
126   <tr>
127     <td align="right" valign="top" class="pageinfo"><?= $label['summary'] ?></td>
128     <td><?= $summary ?></td>
129   </tr>
130 <?php if ($is_current) { ?>
131   <tr>
132     <td align="right"><?= $LOCKED_CB ?></td>
133     <td class="pageinfo"><?=_("Locked")?></td>
134   </tr>
135 <?php } ?>
136
137 <?php // determine page type
138 if (HOME_PAGE == $page->getName()) {
139     $pagetype []= sprintf('%s %s', WIKI_NAME, _("home page"));
140 }
141 if (0 && $page->isUserPage($include_empty=true)) {
142     $pagetype []= _("User page");
143 }
144 if (@$request->isActionPage($page->getName())) {
145     $pagetype []= _("Action page");
146 }
147 if ($page->get('pagetype') == 'wikiblog') {
148     $pagetype []= _("Blog page");
149 }
150 if ($page->getName() == _("InterWikiMap")) {
151     $pagetype []= _("InterWikiMap");
152 }
153 if (0 and isSubPage($page->getName())) {
154     $pagetype []= _("Subpage");
155 } ?>
156
157 <?php if (!empty($pagetype)) { $pagetype = implode(", ", $pagetype); ?>
158   <tr>
159     <td align="right" class="pageinfo"><?=_("Page Type:")?></td>
160     <td align="left"><?=$pagetype?></td>
161   </tr>
162 <?php } ?>
163
164 </table>
165
166 <div id="actionbuttons">
167     <?= Button("viewsource", _("View Source")) ?>
168     <?=$Sep?><?= Button("PageHistory", _("PageHistory")) ?>
169     <?=$Sep?><?= Button("AuthorHistory", _("AuthorHistory")) ?>
170     <?=$Sep?><?= Button("Diff") ?> 
171     <?=$Sep?><?= Button(array('action'=>'diff','previous' => 'minor'),_("Diff previous Revision"),$page->getName()) ?> 
172     <?=$Sep?><?= Button(array('action'=>'diff','previous' => 'author'),_("Diff previous Author"),$page->getName()) ?> 
173 <?php if ((defined('DEBUG') && DEBUG) || $user->isAdmin()) { ?> 
174     <!-- Buttons really only for debugging -->
175     <?=$Sep?><?= Button("DebugInfo", _("DebugInfo")) ?>
176 <?php
177      $PurgeCache = Button(array('nocache' => 'purge'),
178                      _("PurgeHtmlCache"), $page->getName());
179      $PurgeCache->addTooltip(_("Purge HTML cache for this page. Regenerate from WikiMarkup when next accessed."));
180 ?>
181     <?=$Sep?><?= $PurgeCache ?>
182
183     <!-- End debugging buttons -->
184 <?php } ?>
185   </div>
186
187 <?php
188 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -                         
189 // $Log: not supported by cvs2svn $
190 // Revision 1.2  2004/05/18 14:47:21  rurban
191 // Simplified strings for easier translation
192 //
193 // Revision 1.1  2004/03/01 09:38:01  rurban
194 // Theme with less buttons and shorter descriptions:
195 //   More behind "Info"
196 //
197 // Revision 1.15  2003/12/11 19:38:29  carstenklapp
198 // Internal change: Fix PHP Warning: Call-time pass-by-reference has been deprecated
199 //
200 // Revision 1.14  2003/11/29 20:13:38  carstenklapp
201 // Internal change: Refactored ByteFormatter code into a new function in
202 // stdlib (now used by PageList too).
203 //
204 // Revision 1.13  2003/02/21 04:24:48  dairiki
205 // Fix <td> </td> nesting. (Was generating invalid HTML.)
206 //
207 // Revision 1.12  2003/01/11 22:54:28  carstenklapp
208 // Added Page type field displayed for special pages.
209 //
210 ?>