]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/MonoBook/templates/info.tmpl
Merge OldTextFormattingRules into TextFormattingRules; rename underscore plugins
[SourceForge/phpwiki.git] / themes / MonoBook / templates / info.tmpl
1 <?php
2 if (empty($revision)) $revision = $page->getCurrentRevision(false);
3 $modifed = $WikiTheme->formatDateTime($revision->get('mtime'));
4
5 $author = $revision->get('author');
6 global $WikiNameRegexp;
7 $dbi = $request->getDbh();
8 $author = $revision->get('author');
9 $authorLink = $author;
10 if (preg_match("/^$WikiNameRegexp\$/", $author) && $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 if ($bytes < 1024 )
27     $size = fmt("%s bytes", $bytes);
28 else {
29     $kb = round($bytes / 1024, 1);
30     $size = fmt("%s KiB (%s bytes)", $kb, $bytes);
31 }
32 // Count words
33 preg_match_all('/\\w+\\W*/', $revision->_data['%content'], $whitespacematches);
34 if (1 == $c = count_all($whitespacematches))
35   $wordcount = fmt("1 word");
36 else
37   $wordcount = fmt("%s words", $c);
38
39
40 $summary = HTML::textarea(array('name' => 'summary',
41                                 'class' => 'summary',
42                                 /* use fixed dimensions? */
43                                 'rows' => intval($request->getPref('editHeight')/4),
44                                 'cols' => intval($request->getPref('editWidth')/2),
45                                 'readonly' => 'readonly',
46                                ),
47                           $revision->get('summary'));
48
49 if ($is_current = $revision->isCurrent()) {
50
51     $LOCKED_CB = HTML::input(array('type' => 'checkbox',
52                                    'name' => 'edit[locked]',
53                                    'disabled' => !$user->isadmin(),
54                                    'checked'  => $page->get('locked')));
55
56     // Not sure if I want to keep this... --Carsten
57     if ($user->isAdmin()) {
58         $lockunlock = $page->get('locked') ? 'unlock' : 'lock';
59         $clickcheckbUrl = WikiURL($revision, array('action' => $lockunlock));
60         $clickcheckb = "location.href='$clickcheckbUrl'";
61         $LOCKED_CB->setAttr('onclick', $clickcheckb);
62     }
63
64     $label['date'] = _("Last Modified") . _(":");
65     $label['author'] = _("Last Author") . _(":");
66     $label['summary'] = _("Last Summary") . _(":");
67
68 } else {
69     $label['date'] = _("Saved on") . _(":");
70     $label['author'] = _("Author") . _(":");
71     $label['summary'] = _("Summary") . _(":");
72 }
73
74 $tableSummary = fmt("Statistics about %s.", $page->getName());
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 <table class="pageinfo">
88
89 <?php if (!$is_current) { ?>
90   <tr>
91     <td class="align-right pageinfo"><?php echo _("Supplanted on") . _(":") ?></td>
92     <td><?php echo $WikiTheme->formatDateTime($revision->get('_supplanted')) ?></td>
93   </tr>
94 <?php } ?>
95
96   <tr>
97     <td class="align-right nowrap pageinfo"><?php echo $label['date'] ?></td>
98     <td><?php echo $modifed ?><?php echo $minor_flag ?></td>
99   </tr>
100   <tr>
101     <td class="align-right pageinfo"><?php echo $label['author'] ?></td>
102     <td><?php echo $authorLink ?>
103       <?php if (! ($author == $authorId)) { ?>
104         <span class="pageinfo-authorid">(<?php echo $authorId ?>)</span>
105       <?php } ?></td>
106   </tr>
107   <tr>
108     <td class="align-right pageinfo"><?php echo _("Page Version") . _(":") ?></td>
109     <td><?php echo $version ?></td>
110   </tr>
111   <tr>
112     <td class="align-right pageinfo"><?php echo _("Size") . _(":") ?></td>
113     <td><?php echo $wordcount ?>, <?php echo $size ?></td>
114   </tr>
115 <?php if ($is_current) { ?>
116   <tr>
117     <td class="align-right pageinfo"><?php echo _("Hits") . _(":") ?></td>
118     <td><?php echo $hits ?></td>
119   </tr>
120 <?php } ?>
121   <tr>
122     <td class="align-right nowrap top pageinfo"><?php echo $label['summary'] ?></td>
123     <td><?php echo $summary ?></td>
124   </tr>
125 <?php if ($is_current) { ?>
126   <tr>
127     <td class="align-right"><?php echo $LOCKED_CB ?></td>
128     <td class="pageinfo"><?php echo _("Locked")?></td>
129   </tr>
130   <tr>
131     <td class="align-right pageinfo"><?php echo _("ACL type") . _(":") ?></td>
132     <td><?php echo $type ?></td>
133   </tr>
134   <tr>
135     <td class="align-right top pageinfo"><?php echo _("ACL") . _(":") ?></td>
136     <td><?php echo $perm->asAclLines() ?></td>
137   </tr>
138 <?php } ?>
139
140 <?php // determine page type
141 if (HOME_PAGE == $page->getName()) {
142     $pagetype []= sprintf('%s %s', WIKI_NAME, _("Home Page"));
143 }
144 if (0 && $page->isUserPage($include_empty=true)) {
145     $pagetype []= _("User page");
146 }
147 if (isActionPage($page->getName())) {
148     $pagetype []= _("Action Page");
149 }
150 if ($page->get('pagetype') == 'wikiblog') {
151     $pagetype []= _("Blog page");
152 }
153 if ($page->getName() == _("InterWikiMap")) {
154     $pagetype []= _("InterWikiMap");
155 }
156 if (0 and isSubPage($page->getName())) {
157     $pagetype []= _("Subpage");
158 } ?>
159
160 <?php if (!empty($pagetype)) { $pagetype = implode(", ", $pagetype); ?>
161   <tr>
162     <td class="align-right pageinfo"><?php echo _("Page Type") . _(":") ?></td>
163     <td><?php echo $pagetype?></td>
164   </tr>
165 <?php } ?>
166
167 </table>
168
169 <div id="actionbuttons">
170     <?php echo Button("viewsource", _("View Source")) ?>
171     <?php echo $SEP?><?php echo Button("PageHistory", _("PageHistory")) ?>
172     <?php echo $SEP?><?php echo Button("AuthorHistory", _("AuthorHistory")) ?>
173     <?php echo $SEP?><?php echo Button("Diff") ?>
174     <?php echo $SEP?><?php echo Button(array('action'=>'diff','previous' => 'minor'),_("Diff previous Revision"),$page->getName()) ?>
175     <?php echo $SEP?><?php echo Button(array('action'=>'diff','previous' => 'author'),_("Diff previous Author"),$page->getName()) ?>
176 <?php if ((defined('DEBUG') && DEBUG) || $user->isAdmin()) { ?>
177     <!-- Buttons really only for debugging -->
178     <?php echo $SEP?><?php echo Button("DebugInfo", _("DebugInfo")) ?>
179 <?php
180      $PurgeCache = Button(array('nocache' => 'purge'),
181                      _("PurgeHtmlCache"), $page->getName());
182      $PurgeCache->addTooltip(_("Purge HTML cache for this page. Regenerate from WikiMarkup when next accessed."));
183 ?>
184     <?php echo $SEP?><?php echo $PurgeCache ?>
185
186     <!-- End debugging buttons -->
187 <?php } ?>
188 </div>