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