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