]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/default/templates/info.tmpl
new function: asAclGroupLines
[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 = HTML::textarea(array('name' => 'summary',
40                                 'class' => 'summary',
41                                 'rows' => 3,
42                                 'cols' => intval($request->getPref('editWidth')/2),
43                                 'readonly' => 'readonly'
44                                 ),
45                           $revision->get('summary'));
46
47 if ($is_current = $revision->isCurrent()) {
48
49     $LOCKED_CB = HTML::input(array('type' => 'checkbox',
50                                    'name' => 'edit[locked]',
51                                    'disabled' => !$user->isadmin(),
52                                    'checked'  => $page->get('locked')));
53
54     // Not sure if I want to keep this... --Carsten
55     if ($user->isAdmin()) {
56         $lockunlock = $page->get('locked') ? 'unlock' : 'lock';
57         $clickcheckbUrl = WikiURL($revision, array('action' => $lockunlock));
58         $clickcheckb = "location.href='$clickcheckbUrl'";
59
60         $LOCKED_CB->setAttr('onclick', $clickcheckb);
61     }
62
63     $label['date'] = _("Last Modified").':';
64     $label['author'] = _("Last Author").':';
65     $label['summary'] = _("Last Summary").':';
66
67 } else {
68     $label['date'] = _("Saved on:");
69     $label['author'] = _("Author").':';
70     $label['summary'] = _("Summary").':';
71 }
72
73 $tableSummary = fmt("Statistics about %s.", $page->getName());
74 $Sep = $WikiTheme->getButtonSeparator();
75
76 $perm_tree = pagePermissions($page->getName());
77 list($type, $perm) = pagePermissionsAcl($perm_tree[0], $perm_tree);
78 if ($type == 'inherited') {
79     $type = sprintf(_("page permission inherited from %s"), $perm_tree[1][0]);
80 } elseif ($type == 'page') {
81     $type = _("individual page permission");
82 } elseif ($type == 'default') {
83     $type = _("default page permission");
84 }
85 ?>
86
87 <!-- FIXME: move table formatting to css -->
88 <table summary="<?= $tableSummary ?>" class="pageinfo"
89        border="0" cellspacing="0" cellpadding="3">
90
91 <?php if (!$is_current) { ?>
92   <tr>
93     <td align="right" class="pageinfo"><?=_("Supplanted on:")?></td>
94     <td><?= $WikiTheme->formatDateTime($revision->get('_supplanted')) ?></td>
95   </tr>
96 <?php } ?>
97
98   <tr>
99     <td align="right" nowrap="nowrap" class="pageinfo"><?= $label['date'] ?></td>
100     <td><?= $modifed ?><?= $minor_flag ?></td>
101   </tr>
102   <tr>
103     <td align="right" class="pageinfo"><?= $label['author'] ?></td>
104     <td><?= $authorLink ?>
105 <?php if (! ($author == $authorId)) { 
106     if ($dbi->isWikiPage($authorId)) $authorId = WikiLink($authorId); ?>
107         <span class="pageinfo-authorid">(<?= $authorId ?>)</span>
108       <?php } ?></td>
109   </tr>
110   <tr>
111     <td align="right" class="pageinfo"><?=_("Page Version:")?></td>
112     <td><?= $version ?></td>
113   </tr>
114   <tr>
115     <td align="right" class="pageinfo"><?=_("Markup:")?></td>
116     <td><?= $markupVersion ?></td>
117   </tr>
118   <tr>
119     <td align="right" class="pageinfo"><?=_("Size:")?></td>
120     <td><?= $wordcount ?>, <?= $size ?></td>
121   </tr>
122 <?php if ($is_current) { ?>
123   <tr>
124     <td align="right" class="pageinfo"><?= _("Hits:") ?></td>
125     <td><?= $hits ?></td>
126   </tr>
127 <?php } ?>
128   <tr>
129     <td align="right" nowrap="nowrap" valign="top" class="pageinfo"><?= $label['summary'] ?></td>
130     <td><?= $summary ?></td>
131   </tr>
132 <?php if ($is_current) { ?>
133   <tr>
134     <td align="right"><?= $LOCKED_CB ?></td>
135     <td class="pageinfo"><?=_("Locked")?></td>
136   </tr>
137   <tr>
138     <td align="right" class="pageinfo">ACL type</td>
139     <td><?= $type ?></td>
140   </tr>
141   <tr>
142     <td align="right" valign="top" class="pageinfo">ACL</td>
143     <td><?= $perm->asAclGroupLines() ?></td>
144   </tr>
145 <?php } ?>
146
147 <?php // determine page type
148 if (HOME_PAGE == $page->getName()) {
149     $pagetype []= sprintf('%s %s', WIKI_NAME, _("home page"));
150 }
151 if ($page->isUserPage($include_empty=true)) {
152     $pagetype []= _("User page");
153 }
154 if (@$request->isActionPage($page->getName())) {
155     $pagetype []= _("Action page");
156 }
157 if ($page->get('pagetype') == 'wikiblog') {
158     $pagetype []= _("Blog page");
159 }
160 if ($page->getName() == _("InterWikiMap")) {
161     $pagetype []= _("InterWikiMap");
162 }
163 if (isSubPage($page->getName())) {
164     $pagetype []= _("Subpage");
165 } ?>
166
167 <?php if (!empty($pagetype)) { $pagetype = implode(", ", $pagetype); ?>
168   <tr>
169     <td align="right" class="pageinfo"><?=_("Page Type:")?></td>
170     <td align="left"><?=$pagetype?></td>
171   </tr>
172 <?php } ?>
173
174 </table>