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