]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/default/templates/info.tmpl
Added Page type field displayed for special pages.
[SourceForge/phpwiki.git] / themes / default / templates / info.tmpl
1 <?php // -*-html-*- ?>
2 <!-- $Id: info.tmpl,v 1.12 2003-01-11 22:54:28 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 $data = &$revision->_data;
27 $bytes = strlen(&$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*/', &$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><tr>
101     <td align="right" class="pageinfo"><?= $label['author'] ?></td>
102     <td><?= $authorLink ?>
103 <?php if (! ($author == $authorId)) { ?>
104  <span class="pageinfo-authorid">(<?= $authorId ?>)</span>
105 <?php } ?></td>
106   </tr><tr>
107     <td align="right" class="pageinfo"><?=_("Page Version:")?></td>
108     <td><?= $version ?></td>
109   </tr><tr>
110     <td align="right" class="pageinfo"><?=_("Markup:")?></td>
111     <td><?= $markupVersion ?></td>
112   </tr><tr>
113     <td align="right" class="pageinfo"><?=_("Size:")?></td>
114     <td><?= $wordcount ?>, <?= $size ?></td>
115
116 <?php if ($is_current) { ?>
117   </tr><tr>
118     <td align="right" class="pageinfo"><?= _("Hits:") ?></td>
119     <td><?= $hits ?></td>
120 <?php } ?>
121
122   </tr><tr>
123     <td align="right" valign="top" class="pageinfo"><?= $label['summary'] ?></td>
124     <td><?= $summary ?></td>
125
126 <?php if ($is_current) { ?>
127   </tr><tr>
128     <td align="right"><?= $LOCKED_CB ?></td>
129     <td class="pageinfo"><?=_("Locked")?></td>
130 <?php } ?>
131
132 <?php // determine page type
133 if (HOME_PAGE == $page->getName()) {
134     $pagetype []= sprintf('%s %s', WIKI_NAME, _("home page"));
135 }
136 if ($page->isUserPage($include_empty=true)) {
137     $pagetype []= _("User page");
138 }
139 if (@$request->isActionPage($page->getName())) {
140     $pagetype []= _("Action page");
141 }
142 if ($page->get('pagetype') == 'wikiblog') {
143     $pagetype []= _("Blog page");
144 }
145 if ($page->getName() == _("InterWikiMap")) {
146     $pagetype []= _("InterWikiMap");
147 }
148 if (isSubPage($page->getName())) {
149     $pagetype []= _("Subpage");
150 } ?>
151
152 <?php if (!empty($pagetype)) { $pagetype = implode(", ", $pagetype); ?>
153   <tr>
154     <td align="right" class="pageinfo"><?=_("Page Type:")?></td>
155     <td align="left"><?=$pagetype?></td>
156   </tr>
157 <?php } ?>
158
159 </table>
160
161 <?php
162 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -                         
163 // $Log: not supported by cvs2svn $
164 ?>