]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/default/templates/info.tmpl
Remove $Id$
[SourceForge/phpwiki.git] / themes / default / templates / info.tmpl
1 <?php
2 if (empty($revision)) $revision = $page->getCurrentRevision(false);
3 $modifed = $WikiTheme->formatDateTime($revision->get('mtime'));
4
5 $dbi = $request->getDbh();
6 $author = $revision->get('author');
7 $authorLink = $author;
8 if ($dbi->isWikiPage($author))
9     $authorLink = WikiLink($author);
10
11 $authorId = $revision->get('author_id');
12 $version = $revision->getVersion();
13 $hits = $page->get('hits');
14
15 $is_minor_edit = $revision->get('is_minor_edit') ? _("minor edit") : false;
16 if ($minor_flag = $is_minor_edit) {
17     $minor_flag = HTML(" ",
18                        HTML::span(array('class' => 'pageinfo-minoredit'),
19                                   "(" . _("minor edit") . ")"));
20 }
21
22 /* better way to do this? */
23 $bytes = strlen($revision->_data['%content']);
24 $size = ByteFormatter($bytes, /* $longformat = */true);
25 // Count words
26 preg_match_all('/\\w+\\W*/', $revision->_data['%content'], $whitespacematches);
27 if (1 == ($c = count_all($whitespacematches)))
28   $wordcount = fmt("1 word");
29 else
30   $wordcount = fmt("%s words", $c);
31
32
33 $markupVersion = ($markupVersion = $revision->get('markup'))
34                ? fmt("Version %s", $markupVersion)
35                : _("Original (1.2 or 1.0)");
36
37 $summary = $revision->get('summary');
38
39 if ($is_current = $revision->isCurrent()) {
40
41     $LOCKED_CB = HTML::input(array('type' => 'checkbox',
42                                    'name' => 'edit[locked]',
43                                    'disabled' => !$user->isadmin(),
44                                    'checked'  => $page->get('locked')));
45
46     // Not sure if I want to keep this... --Carsten
47     if ($user->isAdmin()) {
48         $lockunlock = $page->get('locked') ? 'unlock' : 'lock';
49         $clickcheckbUrl = WikiURL($revision, array('action' => $lockunlock));
50         $clickcheckb = "location.href='$clickcheckbUrl'";
51         $LOCKED_CB->setAttr('onclick', $clickcheckb);
52     }
53
54     $label['date'] = _("Last Modified") . _(":");
55     $label['author'] = _("Last Author") . _(":");
56     $label['summary'] = _("Last Summary") . _(":");
57
58 } else {
59     $label['date'] = _("Saved on") . _(":");
60     $label['author'] = _("Author") . _(":");
61     $label['summary'] = _("Summary") . _(":");
62 }
63
64 $tableSummary = fmt("Statistics about %s.", $page->getName());
65 $Sep = $WikiTheme->getButtonSeparator();
66
67 $perm_tree = pagePermissions($page->getName());
68 list($type, $perm) = pagePermissionsAcl($perm_tree[0], $perm_tree);
69 if ($type == 'inherited') {
70     $type = sprintf(_("page permission inherited from %s"), $perm_tree[1][0]);
71 } elseif ($type == 'page') {
72     $type = _("individual page permission");
73 } elseif ($type == 'default') {
74     $type = _("default page permission");
75 }
76 ?>
77
78 <table summary="<?php echo $tableSummary ?>" class="pageinfo">
79
80 <?php if (!$is_current) { ?>
81   <tr>
82     <td class="align-right pageinfo"><?php echo _("Supplanted on") . _(":") ?></td>
83     <td><?php echo $WikiTheme->formatDateTime($revision->get('_supplanted')) ?></td>
84   </tr>
85 <?php } ?>
86
87   <tr>
88     <td class="align-right nowrap pageinfo"><?php echo $label['date'] ?></td>
89     <td><?php echo $modifed ?><?php echo $minor_flag ?></td>
90   </tr>
91   <tr>
92     <td class="align-right pageinfo"><?php echo $label['author'] ?></td>
93     <td><?php echo $authorLink ?>
94 <?php if (! ($author == $authorId)) {
95     if ($dbi->isWikiPage($authorId)) $authorId = WikiLink($authorId); ?>
96         <span class="pageinfo-authorid">(<?php echo $authorId ?>)</span>
97       <?php } ?></td>
98   </tr>
99   <tr>
100     <td class="align-right pageinfo"><?php echo _("Page Version") . _(":") ?></td>
101     <td><?php echo $version ?></td>
102   </tr>
103   <tr>
104     <td class="align-right pageinfo"><?php echo _("Markup") . _(":") ?></td>
105     <td><?php echo $markupVersion ?></td>
106   </tr>
107   <tr>
108     <td class="align-right pageinfo"><?php echo _("Size") . _(":") ?></td>
109     <td><?php echo $wordcount ?>, <?php echo $size ?></td>
110   </tr>
111 <?php if ($is_current) { ?>
112   <tr>
113     <td class="align-right pageinfo"><?php echo _("Hits") . _(":") ?></td>
114     <td><?php echo $hits ?></td>
115   </tr>
116 <?php } ?>
117   <tr>
118     <td class="align-right nowrap top pageinfo"><?php echo $label['summary'] ?></td>
119     <td><?php echo $summary ?></td>
120   </tr>
121 <?php if ($is_current) { ?>
122   <tr>
123     <td class="align-right"><?php echo $LOCKED_CB ?></td>
124     <td class="pageinfo"><?php echo _("Locked")?></td>
125   </tr>
126 <?php if (ENABLE_EXTERNAL_PAGES) { ?>
127   <tr>
128     <td class="align-right pageinfo"><?php echo _("Is External") . _(":") ?></td>
129     <td><?php echo $page->get('external') ? _("Yes") : _("No") ?></td>
130   </tr>
131 <?php } ?>
132   <tr>
133     <td class="align-right pageinfo"><?php echo _("ACL type") . _(":") ?></td>
134     <td><?php echo $type ?></td>
135   </tr>
136   <tr>
137     <td class="align-right top pageinfo"><?php echo _("ACL") . _(":") ?></td>
138     <td><?php echo $perm->asAclLines() ?></td>
139   </tr>
140 <?php } ?>
141
142 <?php // determine page type
143 if (HOME_PAGE == $page->getName()) {
144     $pagetype []= sprintf('%s %s', WIKI_NAME, _("Home Page"));
145 }
146 if ($page->isUserPage($include_empty=true)) {
147     $pagetype []= _("User page");
148 }
149 if (isActionPage($page->getName())) {
150     $pagetype []= _("Action Page");
151 }
152 if ($page->get('pagetype') == 'wikiblog') {
153     $pagetype []= _("Blog page");
154 }
155 if ($page->getName() == _("InterWikiMap")) {
156     $pagetype []= _("InterWikiMap");
157 }
158 if (isSubPage($page->getName())) {
159     $pagetype []= _("Subpage");
160 } ?>
161
162 <?php if (!empty($pagetype)) { $pagetype = implode(", ", $pagetype); ?>
163   <tr>
164     <td class="align-right pageinfo"><?php echo _("Page Type") . _(":") ?></td>
165     <td><?php echo $pagetype?></td>
166   </tr>
167 <?php } ?>
168
169 </table>