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