]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/MonoBook/templates/info.tmpl
<?= --> <?php echo
[SourceForge/phpwiki.git] / themes / MonoBook / templates / info.tmpl
1 <?php // -*-php-*-
2 // rcs_id('$Id$');
3 ?>
4 <?php
5 if (empty($revision)) $revision = $page->getCurrentRevision(false);
6 $modifed = $WikiTheme->formatDateTime($revision->get('mtime'));
7
8 $author = $revision->get('author');
9 global $WikiNameRegexp;
10 $dbi = $request->getDbh();
11 $author = $revision->get('author');
12 $authorLink = $author;
13 if (preg_match("/^$WikiNameRegexp\$/", $author) && $dbi->isWikiPage($author))
14     $authorLink = WikiLink($author);
15
16 $authorId = $revision->get('author_id');
17 $version = $revision->getVersion();
18 $hits = $page->get('hits');
19
20 $is_minor_edit = $revision->get('is_minor_edit') ? _("minor edit") : false;
21 if ($minor_flag = $is_minor_edit) {
22     $minor_flag = HTML(" ",
23                        HTML::span(array('class' => 'pageinfo-minoredit'),
24                                   "(" . _("minor edit") . ")"));
25 }
26
27 /* better way to do this? */
28 $bytes = strlen($revision->_data['%content']);
29 if ($bytes < 1024 )
30     $size = fmt("%s bytes", $bytes);
31 else {
32     $kb = round($bytes / 1024, 1);
33     $size = fmt("%s Kb (%s bytes)", $kb, $bytes);
34 }
35 // Count words
36 preg_match_all('/\\w+\\W*/', $revision->_data['%content'], $whitespacematches);
37 if (1 == $c = count_all($whitespacematches))
38   $wordcount = fmt("1 word");
39 else
40   $wordcount = fmt("%s words", $c);
41
42
43 $markupVersion = ($markupVersion = $revision->get('markup'))
44                ? fmt("Version %s", $markupVersion)
45                : _("Original (1.2 or 1.0)");
46
47 $summary = HTML::textarea(array('name' => 'summary',
48                                 'class' => 'summary',
49                                 /* use fixed dimensions? */
50                                 'rows' => intval($request->getPref('editHeight')/4),
51                                 'cols' => intval($request->getPref('editWidth')/2),
52                                 'readonly' => 'readonly',
53                                ),
54                           $revision->get('summary'));
55
56 if ($is_current = $revision->isCurrent()) {
57
58     $LOCKED_CB = HTML::input(array('type' => 'checkbox',
59                                    'name' => 'edit[locked]',
60                                    'disabled' => !$user->isadmin(),
61                                    'checked'  => $page->get('locked')));
62
63     // Not sure if I want to keep this... --Carsten
64     if ($user->isadmin()) {
65         $lockunlock = $page->get('locked') ? 'unlock' : 'lock';
66         $clickcheckbUrl = WikiURL($revision, array('action' => $lockunlock));
67         $clickcheckb = "location.href='$clickcheckbUrl'";
68
69         $LOCKED_CB->setAttr('onclick', $clickcheckb);
70     }
71
72     $label['date'] = _("Last Modified").':';
73     $label['author'] = _("Last Author").':';
74     $label['summary'] = _("Last Summary").':';
75
76 } else {
77     $label['date'] = _("Saved on:");
78     $label['author'] = _("Author").':';
79     $label['summary'] = _("Summary").':';
80 }
81
82 $tableSummary = fmt("Statistics about %s.", $page->getName());
83
84 $perm_tree = pagePermissions($page->getName());
85 list($type, $perm) = pagePermissionsAcl($perm_tree[0], $perm_tree);
86 if ($type == 'inherited') {
87     $type = sprintf(_("page permission inherited from %s"), $perm_tree[1][0]);
88 } elseif ($type == 'page') {
89     $type = _("individual page permission");
90 } elseif ($type == 'default') {
91     $type = _("default page permission");
92 }
93
94 ?>
95
96 <!-- FIXME: move table formatting to css -->
97 <table summary="<?php echo $tableSummary ?>" class="pageinfo"
98        border="0" cellspacing="0" cellpadding="3">
99
100 <?php if (!$is_current) { ?>
101   <tr>
102     <td align="right" class="pageinfo"><?php echo _("Supplanted on:")?></td>
103     <td><?php echo $WikiTheme->formatDateTime($revision->get('_supplanted')) ?></td>
104   </tr>
105 <?php } ?>
106
107   <tr>
108     <td align="right" nowrap="nowrap" class="pageinfo"><?php echo $label['date'] ?></td>
109     <td><?php echo $modifed ?><?php echo $minor_flag ?></td>
110   </tr>
111   <tr>
112     <td align="right" class="pageinfo"><?php echo $label['author'] ?></td>
113     <td><?php echo $authorLink ?>
114       <?php if (! ($author == $authorId)) { ?>
115         <span class="pageinfo-authorid">(<?php echo $authorId ?>)</span>
116       <?php } ?></td>
117   </tr>
118   <tr>
119     <td align="right" class="pageinfo"><?php echo _("Page Version:")?></td>
120     <td><?php echo $version ?></td>
121   </tr>
122   <tr>
123     <td align="right" class="pageinfo"><?php echo _("Markup:")?></td>
124     <td><?php echo $markupVersion ?></td>
125   </tr>
126   <tr>
127     <td align="right" class="pageinfo"><?php echo _("Size:")?></td>
128     <td><?php echo $wordcount ?>, <?php echo $size ?></td>
129   </tr>
130 <?php if ($is_current) { ?>
131   <tr>
132     <td align="right" class="pageinfo"><?php echo _("Hits:") ?></td>
133     <td><?php echo $hits ?></td>
134   </tr>
135 <?php } ?>
136   <tr>
137     <td align="right" valign="top" class="pageinfo"><?php echo $label['summary'] ?></td>
138     <td><?php echo $summary ?></td>
139   </tr>
140 <?php if ($is_current) { ?>
141   <tr>
142     <td align="right"><?php echo $LOCKED_CB ?></td>
143     <td class="pageinfo"><?php echo _("Locked")?></td>
144   </tr>
145   <tr>
146     <td align="right" class="pageinfo">ACL type</td>
147     <td><?php echo $type ?></td>
148   </tr>
149   <tr>
150     <td align="right" valign="top" class="pageinfo">ACL</td>
151     <td><?php echo $perm->asAclGroupLines() ?></td>
152   </tr>
153 <?php } ?>
154
155 <?php // determine page type
156 if (HOME_PAGE == $page->getName()) {
157     $pagetype []= sprintf('%s %s', WIKI_NAME, _("home page"));
158 }
159 if (0 && $page->isUserPage($include_empty=true)) {
160     $pagetype []= _("User page");
161 }
162 if (isActionPage($page->getName())) {
163     $pagetype []= _("Action page");
164 }
165 if ($page->get('pagetype') == 'wikiblog') {
166     $pagetype []= _("Blog page");
167 }
168 if ($page->getName() == _("InterWikiMap")) {
169     $pagetype []= _("InterWikiMap");
170 }
171 if (0 and isSubPage($page->getName())) {
172     $pagetype []= _("Subpage");
173 } ?>
174
175 <?php if (!empty($pagetype)) { $pagetype = implode(", ", $pagetype); ?>
176   <tr>
177     <td align="right" class="pageinfo"><?php echo _("Page Type:")?></td>
178     <td align="left"><?php echo $pagetype?></td>
179   </tr>
180 <?php } ?>
181
182 </table>
183
184 <div id="actionbuttons">
185     <?php echo Button("viewsource", _("View Source")) ?>
186     <?php echo $SEP?><?php echo Button("PageHistory", _("PageHistory")) ?>
187     <?php echo $SEP?><?php echo Button("AuthorHistory", _("AuthorHistory")) ?>
188     <?php echo $SEP?><?php echo Button("Diff") ?> 
189     <?php echo $SEP?><?php echo Button(array('action'=>'diff','previous' => 'minor'),_("Diff previous Revision"),$page->getName()) ?> 
190     <?php echo $SEP?><?php echo Button(array('action'=>'diff','previous' => 'author'),_("Diff previous Author"),$page->getName()) ?> 
191 <?php if ((defined('DEBUG') && DEBUG) || $user->isAdmin()) { ?> 
192     <!-- Buttons really only for debugging -->
193     <?php echo $SEP?><?php echo Button("DebugInfo", _("DebugInfo")) ?>
194 <?php
195      $PurgeCache = Button(array('nocache' => 'purge'),
196                      _("PurgeHtmlCache"), $page->getName());
197      $PurgeCache->addTooltip(_("Purge HTML cache for this page. Regenerate from WikiMarkup when next accessed."));
198 ?>
199     <?php echo $SEP?><?php echo $PurgeCache ?>
200
201     <!-- End debugging buttons -->
202 <?php } ?>
203 </div>