Added ns-{{ns:}} class to body (example: ns-0 for the main ns) to allow users/skins...
[lhc/web/wiklou.git] / includes / SkinPHPTal.php
1 <?php
2 # Generic PHPTal (http://phptal.sourceforge.net/) skin
3 # Based on Brion's smarty skin
4 # Copyright (C) Gabriel Wicke -- http://www.aulinx.de/
5 #
6 # Todo: Needs some serious refactoring into functions that correspond
7 # to the computations individual esi snippets need. Most importantly no body
8 # parsing for most of those of course.
9 #
10 # Set this in LocalSettings to enable phptal:
11 # set_include_path(get_include_path() . ":" . $IP.'/PHPTAL-NP-0.7.0/libs');
12 # $wgUsePHPTal = true;
13 #
14 # This program is free software; you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation; either version 2 of the License, or
17 # (at your option) any later version.
18 #
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License along
25 # with this program; if not, write to the Free Software Foundation, Inc.,
26 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 # http://www.gnu.org/copyleft/gpl.html
28
29 require_once "GlobalFunctions.php";
30 require_once $IP."/PHPTAL-NP-0.7.0/libs/PHPTAL.php";
31
32 class MediaWiki_I18N extends PHPTAL_I18N
33 {
34 var $_context = array();
35
36 function set($varName, $value) {
37 $this->_context[$varName] = $value;
38 }
39
40 function translate($value) {
41 $value = wfMsg( $value );
42 // interpolate variables
43 while (preg_match('/\$([0-9]*?)/sm', $value, $m)) {
44 list($src, $var) = $m;
45 $varValue = @$this->_context[$var];
46 $value = str_replace($src, $varValue, $value);
47 }
48 return $value;
49 }
50 }
51
52 class SkinPHPTal extends Skin {
53 var $template;
54
55 function initPage( &$out ) {
56 parent::initPage( $out );
57 $this->skinname = "davinci";
58 $this->template = "xhtml_slim";
59 }
60
61 function outputPage( &$out ) {
62 global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgOut;
63 global $wgScript, $wgStylePath, $wgLanguageCode, $wgUseNewInterlanguage;
64 global $wgMimeType, $wgOutputEncoding, $wgUseDatabaseMessages, $wgRequest;
65 global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses;
66
67 extract( $wgRequest->getValues( 'oldid', 'diff' ) );
68
69 $this->initPage( $out );
70 $tpl = new PHPTAL($this->template . '.pt', 'templates');
71
72 #if ( $wgUseDatabaseMessages ) { // uncomment this to fall back to GetText
73 $tpl->setTranslator(new MediaWiki_I18N());
74 #}
75
76 $this->thispage = $wgTitle->getPrefixedDbKey();
77 $this->thisurl = $wgTitle->getPrefixedURL();
78 $this->loggedin = $wgUser->getID() != 0;
79 $this->iscontent = ($wgTitle->getNamespace() != Namespace::getSpecial() );
80 $this->iseditable = ($this->iscontent and !($action == 'edit' or $action == 'submit'));
81 $this->username = $wgUser->getName();
82 $this->userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName();
83 $this->userpageUrlDetails = $this->makeUrlDetails($this->userpage);
84
85 $this->usercss = $this->userjs = $this->userjsprev = false;
86 if( $this->loggedin ) { $this->setupUserCssJs(); }
87
88 $this->titletxt = $wgTitle->getPrefixedText();
89
90 $tpl->set( "title", $wgOut->getPageTitle() );
91 $tpl->set( "pagetitle", $wgOut->getHTMLTitle() );
92
93 $tpl->setRef( "thispage", &$this->thispage );
94 $subpagestr = $this->subPageSubtitle();
95 $tpl->set(
96 "subtitle", !empty($subpagestr)?
97 '<span class="subpages">'.$subpagestr.'</span>'.$out->getSubtitle():
98 $out->getSubtitle()
99 );
100 $tpl->set( 'catlinks', $this->getCategories());
101 if( $wgOut->isSyndicated() ) {
102 $feeds = array();
103 foreach( $wgFeedClasses as $format => $class ) {
104 $feeds[$format] = array(
105 'text' => $format,
106 'href' => $wgRequest->appendQuery( "feed=$format" ),
107 'ttip' => wfMsg('tooltip-'.$format)
108 );
109 }
110 $tpl->setRef( 'feeds', &$feeds );
111 }
112 $tpl->setRef( 'mimetype', &$wgMimeType );
113 $tpl->setRef( 'charset', &$wgOutputEncoding );
114 $tpl->set( 'headlinks', $out->getHeadLinks() );
115 $tpl->setRef( 'skinname', &$this->skinname );
116 $tpl->setRef( "loggedin", &$this->loggedin );
117 $tpl->set('nsclass', 'ns-'.$wgTitle->getNamespace());
118 /* XXX currently unused, might get useful later
119 $tpl->set( "editable", ($wgTitle->getNamespace() != NS_SPECIAL ) );
120 $tpl->set( "exists", $wgTitle->getArticleID() != 0 );
121 $tpl->set( "watch", $wgTitle->userIsWatching() ? "unwatch" : "watch" );
122 $tpl->set( "protect", count($wgTitle->getRestrictions()) ? "unprotect" : "protect" );
123 $tpl->set( "helppage", wfMsg('helppage'));
124 $tpl->set( "sysop", $wgUser->isSysop() );
125 */
126 $tpl->set( "searchaction", $this->escapeSearchLink() );
127 $tpl->setRef( "stylepath", &$wgStylePath );
128 $tpl->setRef( "logopath", &$wgLogo );
129 $tpl->setRef( "lang", &$wgLanguageCode );
130 $tpl->set( "dir", $wgLang->isRTL() ? "rtl" : "ltr" );
131 $tpl->set( "rtl", $wgLang->isRTL() );
132 $tpl->set( "langname", $wgLang->getLanguageName( $wgLanguageCode ) );
133 $tpl->setRef( "username", &$this->username );
134 $tpl->setRef( "userpage", &$this->userpage);
135 $tpl->setRef( "userpageurl", &$this->userpageUrlDetails['href']);
136 $tpl->setRef( "usercss", &$this->usercss);
137 $tpl->setRef( "userjs", &$this->userjs);
138 $tpl->setRef( "userjsprev", &$this->userjsprev);
139 if( $wgUser->getNewtalk() ) {
140 $usertitle = Title::newFromText( $this->userpage );
141 $usertalktitle = $usertitle->getTalkPage();
142 if($usertalktitle->getPrefixedDbKey() != $this->thispage){
143
144 $ntl = wfMsg( "newmessages",
145 $this->makeKnownLink(
146 $wgLang->getNsText( Namespace::getTalk( Namespace::getUser() ) )
147 . ":" . $this->username,
148 wfMsg("newmessageslink") )
149 );
150 }
151 } else {
152 $ntl = "";
153 }
154
155 $tpl->setRef( "newtalk", &$ntl );
156 $tpl->setRef( "skin", &$this);
157 $tpl->set( "logo", $this->logoText() );
158 if ( $wgOut->isArticle() and (!isset( $oldid ) or isset( $diff )) and 0 != $wgArticle->getID() ) {
159 if ( !$wgDisableCounters ) {
160 $viewcount = $wgLang->formatNum( $wgArticle->getCount() );
161 if ( $viewcount ) {
162 $tpl->set('viewcount', wfMsg( "viewcount", $viewcount ));
163 }
164 }
165 $tpl->set('lastmod', $this->lastModified());
166 $tpl->set('copyright',$this->getCopyright());
167 }
168 $tpl->set( "copyrightico", $this->getCopyrightIcon() );
169 $tpl->set( "poweredbyico", $this->getPoweredBy() );
170 $tpl->set( "disclaimer", $this->disclaimerLink() );
171 $tpl->set( "about", $this->aboutLink() );
172
173 $tpl->setRef( "debug", &$out->mDebugtext );
174 $tpl->set( "reporttime", $out->reportTime() );
175
176 $tpl->setRef( "bodytext", &$out->mBodytext );
177
178 $language_urls = array();
179 foreach( $wgOut->getLanguageLinks() as $l ) {
180 $nt = Title::newFromText( $l );
181 $language_urls[] = array('href' => $nt->getFullURL(),
182 'text' => ($wgLang->getLanguageName( $nt->getInterwiki()) != ''?$wgLang->getLanguageName( $nt->getInterwiki()) : $l),
183 'class' => $wgLang->isRTL() ? 'rtl' : 'ltr');
184 }
185 if(count($language_urls)) {
186 $tpl->setRef( 'language_urls', &$language_urls);
187 } else {
188 $tpl->set('language_urls', false);
189 }
190 $tpl->set('personal_urls', $this->buildPersonalUrls());
191 $content_actions = $this->buildContentActionUrls();
192 $tpl->setRef('content_actions', &$content_actions);
193 // XXX: attach this from javascript, same with section editing
194 if($this->iseditable && $wgUser->getOption("editondblclick") )
195 {
196 $tpl->set('body-ondblclick', 'document.location = "' .$content_actions['edit']['href'] .'";');
197 } else {
198 $tpl->set('body-ondblclick', false);
199 }
200 $tpl->set( "nav_urls", $this->buildNavUrls() );
201
202 // execute template
203 $res = $tpl->execute();
204 // result may be an error
205 if (PEAR::isError($res)) {
206 echo $res->toString(), "\n";
207 } else {
208 echo $res;
209 }
210
211 }
212
213 # build array of urls for personal toolbar
214 function buildPersonalUrls() {
215 /* set up the default links for the personal toolbar */
216 global $wgShowIPinHeader;
217 $personal_urls = array();
218 if ($this->loggedin) {
219 $personal_urls['userpage'] = array(
220 'text' => $this->username,
221 'href' => &$this->userpageUrlDetails['href'],
222 'class' => $this->userpageUrlDetails['exists']?false:'new',
223 'ttip' => wfMsg('tooltip-userpage'),
224 'akey' => wfMsg('accesskey-userpage')
225 );
226 $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage);
227 $personal_urls['mytalk'] = array(
228 'text' => wfMsg('mytalk'),
229 'href' => &$usertalkUrlDetails['href'],
230 'class' => $usertalkUrlDetails['exists']?false:'new',
231 'ttip' => wfMsg('tooltip-mytalk'),
232 'akey' => wfMsg('accesskey-mytalk')
233 );
234 $personal_urls['preferences'] = array(
235 'text' => wfMsg('preferences'),
236 'href' => $this->makeSpecialUrl('Preferences'),
237 'ttip' => wfMsg('tooltip-preferences'),
238 'akey' => wfMsg('accesskey-preferences')
239 );
240 $personal_urls['watchlist'] = array(
241 'text' => wfMsg('watchlist'),
242 'href' => $this->makeSpecialUrl('Watchlist'),
243 'ttip' => wfMsg('tooltip-watchlist'),
244 'akey' => wfMsg('accesskey-watchlist')
245 );
246 $personal_urls['mycontris'] = array(
247 'text' => wfMsg('mycontris'),
248 'href' => $this->makeSpecialUrl('Contributions','target=' . $this->username),
249 'ttip' => wfMsg('tooltip-mycontris'),
250 'akey' => wfMsg('accesskey-mycontris')
251 );
252 $personal_urls['logout'] = array(
253 'text' => wfMsg('userlogout'),
254 'href' => $this->makeSpecialUrl('Userlogout','returnto=' . $this->thisurl),
255 'ttip' => wfMsg('tooltip-logout'),
256 'akey' => wfMsg('accesskey-logout')
257 );
258 } else {
259 if( $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] ) ) {
260 $personal_urls['anonuserpage'] = array(
261 'text' => $this->username,
262 'href' => &$this->userpageUrlDetails['href'],
263 'class' => $this->userpageUrlDetails['exists']?false:'new',
264 'ttip' => wfMsg('tooltip-anonuserpage'),
265 'akey' => wfMsg('accesskey-anonuserpage')
266 );
267 $usertalkUrlDetails = $this->makeTalkUrlDetails($this->userpage);
268 $personal_urls['anontalk'] = array(
269 'text' => wfMsg('anontalk'),
270 'href' => &$usertalkUrlDetails['href'],
271 'class' => $usertalkUrlDetails['exists']?false:'new',
272 'ttip' => wfMsg('tooltip-anontalk'),
273 'akey' => wfMsg('accesskey-anontalk')
274 );
275 $personal_urls['anonlogin'] = array(
276 'text' => wfMsg('userlogin'),
277 'href' => $this->makeSpecialUrl('Userlogin', 'returnto='.$this->thisurl),
278 'ttip' => wfMsg('tooltip-login'),
279 'akey' => wfMsg('accesskey-login')
280 );
281 } else {
282
283 $personal_urls['login'] = array(
284 'text' => wfMsg('userlogin'),
285 'href' => $this->makeSpecialUrl('Userlogin', 'returnto='.$this->thisurl),
286 'ttip' => wfMsg('tooltip-login'),
287 'akey' => wfMsg('accesskey-login')
288 );
289 }
290 }
291
292 return $personal_urls;
293 }
294
295 # an array of edit links by default used for the tabs
296 function buildContentActionUrls () {
297 global $wgTitle, $wgUser, $wgRequest;
298 $action = $wgRequest->getText( 'action' );
299 $section = $wgRequest->getText( 'section' );
300 $oldid = $wgRequest->getVal( 'oldid' );
301 $diff = $wgRequest->getVal( 'diff' );
302 $content_actions = array();
303
304 if( $this->iscontent ) {
305
306 $content_actions['article'] = array('class' => (!Namespace::isTalk( $wgTitle->getNamespace())) ? 'selected' : false,
307 'text' => $this->getNameSpaceWord(),
308 'href' => $this->makeArticleUrl($this->thispage),
309 'ttip' => wfMsg('tooltip-article'),
310 'akey' => wfMsg('accesskey-article'));
311
312 /* set up the classes for the talk link */
313 $talk_class = (Namespace::isTalk( $wgTitle->getNamespace()) ? 'selected' : false);
314 $talktitle = Title::newFromText( $this->titletxt );
315 $talktitle = $talktitle->getTalkPage();
316 $this->checkTitle(&$talktitle, &$this->titletxt);
317 if($talktitle->getArticleId() != 0) {
318 $content_actions['talk'] = array(
319 'class' => $talk_class,
320 'text' => wfMsg('talk'),
321 'href' => $this->makeTalkUrl($this->titletxt),
322 'ttip' => wfMsg('tooltip-talk'),
323 'akey' => wfMsg('accesskey-talk')
324 );
325 } else {
326 $content_actions['talk'] = array(
327 'class' => $talk_class?$talk_class.' new':'new',
328 'text' => wfMsg('talk'),
329 'href' => $this->makeTalkUrl($this->titletxt,'action=edit'),
330 'ttip' => wfMsg('tooltip-talk'),
331 'akey' => wfMsg('accesskey-talk')
332 );
333 }
334
335 if ( $wgTitle->userCanEdit() ) {
336 $oid = ( $oldid && ! isset( $diff ) ) ? "&oldid={$oldid}" : false;
337 $istalk = ( Namespace::isTalk( $wgTitle->getNamespace()) );
338 $istalkclass = $istalk?' istalk':'';
339 $content_actions['edit'] = array(
340 'class' => ((($action == 'edit' or $action == 'submit') and $section != 'new') ? 'selected' : '').$istalkclass,
341 'text' => wfMsg('edit'),
342 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid),
343 'ttip' => wfMsg('tooltip-edit'),
344 'akey' => wfMsg('accesskey-edit')
345 );
346 if ( $istalk ) {
347 $content_actions['addsection'] = array(
348 'class' => $section == 'new'?'selected':false,
349 'text' => wfMsg('addsection'),
350 'href' => $this->makeUrl($this->thispage, 'action=edit&section=new'),
351 'ttip' => wfMsg('tooltip-addsection'),
352 'akey' => wfMsg('accesskey-addsection')
353 );
354 }
355 } else {
356 $oid = ( $oldid && ! isset( $diff ) ) ? "&oldid={$oldid}" : '';
357 $content_actions['edit'] = array('class' => ($action == 'edit') ? 'selected' : false,
358 'text' => wfMsg('viewsource'),
359 'href' => $this->makeUrl($this->thispage, 'action=edit'.$oid),
360 'ttip' => wfMsg('tooltip-viewsource'),
361 'akey' => wfMsg('accesskey-viewsource'));
362 }
363
364 if ( $wgTitle->getArticleId() ) {
365
366 $content_actions['history'] = array('class' => ($action == 'history') ? 'selected' : false,
367 'text' => wfMsg('history_short'),
368 'href' => $this->makeUrl($this->thispage, 'action=history'),
369 'ttip' => wfMsg('tooltip-history'),
370 'akey' => wfMsg('accesskey-history'));
371
372 # XXX: is there a rollback action anywhere or is it planned?
373 # Don't recall where i got this from...
374 /*if( $wgUser->getNewtalk() ) {
375 $content_actions['rollback'] = array('class' => ($action == 'rollback') ? 'selected' : false,
376 'text' => wfMsg('rollback_short'),
377 'href' => $this->makeUrl($this->thispage, 'action=rollback'),
378 'ttip' => wfMsg('tooltip-rollback'),
379 'akey' => wfMsg('accesskey-rollback'));
380 }*/
381
382 if($wgUser->isSysop()){
383 if(!$wgTitle->isProtected()){
384 $content_actions['protect'] = array(
385 'class' => ($action == 'protect') ? 'selected' : false,
386 'text' => wfMsg('protect'),
387 'href' => $this->makeUrl($this->thispage, 'action=protect'),
388 'ttip' => wfMsg('tooltip-protect'),
389 'akey' => wfMsg('accesskey-protect')
390 );
391
392 } else {
393 $content_actions['unprotect'] = array(
394 'class' => ($action == 'unprotect') ? 'selected' : false,
395 'text' => wfMsg('unprotect'),
396 'href' => $this->makeUrl($this->thispage, 'action=unprotect'),
397 'ttip' => wfMsg('tooltip-protect'),
398 'akey' => wfMsg('accesskey-protect')
399 );
400 }
401 $content_actions['delete'] = array(
402 'class' => ($action == 'delete') ? 'selected' : false,
403 'text' => wfMsg('delete'),
404 'href' => $this->makeUrl($this->thispage, 'action=delete'),
405 'ttip' => wfMsg('tooltip-delete'),
406 'akey' => wfMsg('accesskey-delete')
407 );
408 }
409 if ( $wgUser->getID() != 0 ) {
410 if ( $wgTitle->userCanEdit()) {
411 $content_actions['move'] = array('class' => ($wgTitle->getDbKey() == 'Movepage' and $wgTitle->getNamespace == Namespace::getSpecial()) ? 'selected' : false,
412 'text' => wfMsg('move'),
413 'href' => $this->makeSpecialUrl('Movepage', 'target='.$this->thispage),
414 'ttip' => wfMsg('tooltip-move'),
415 'akey' => wfMsg('accesskey-move'));
416 } else {
417 $content_actions['move'] = array('class' => 'inactive',
418 'text' => wfMsg('move'),
419 'href' => false,
420 'ttip' => wfMsg('tooltip-nomove'),
421 'akey' => false);
422
423 }
424 }
425 } else {
426 //article doesn't exist or is deleted
427 if($wgUser->isSysop()){
428 if( $n = $wgTitle->isDeleted() ) {
429 $content_actions['delete'] = array(
430 'class' => false,
431 'text' => wfMsg( "undelete_short", $n ),
432 'href' => $this->makeSpecialUrl('Undelete/'.$this->thispage),
433 'ttip' => wfMsg('tooltip-undelete', $n),
434 'akey' => wfMsg('accesskey-undelete')
435 );
436 }
437 }
438 }
439
440 if ( $wgUser->getID() != 0 and $action != 'edit' and $action != 'submit' ) {
441 if( !$wgTitle->userIsWatching()) {
442 $content_actions['watch'] = array('class' => ($action == 'watch' or $action == 'unwatch') ? 'selected' : false,
443 'text' => wfMsg('watch'),
444 'href' => $this->makeUrl($this->thispage, 'action=watch'),
445 'ttip' => wfMsg('tooltip-watch'),
446 'akey' => wfMsg('accesskey-watch'));
447 } else {
448 $content_actions['watch'] = array('class' => ($action == 'unwatch' or $action == 'watch') ? 'selected' : false,
449 'text' => wfMsg('unwatch'),
450 'href' => $this->makeUrl($this->thispage, 'action=unwatch'),
451 'ttip' => wfMsg('tooltip-unwatch'),
452 'akey' => wfMsg('accesskey-unwatch'));
453
454 }
455 }
456 } else {
457 /* show special page tab */
458
459 $content_actions['article'] = array('class' => 'selected',
460 'text' => wfMsg('specialpage'),
461 'href' => false,
462 'ttip' => wfMsg('tooltip-specialpage'),
463 'akey' => false);
464 }
465
466 return $content_actions;
467 }
468
469 # build array of common navigation links
470 function buildNavUrls () {
471 global $wgTitle, $wgUser, $wgRequest;
472 global $wgSiteSupportPage;
473
474 $action = $wgRequest->getText( 'action' );
475 $oldid = $wgRequest->getVal( 'oldid' );
476 $diff = $wgRequest->getVal( 'diff' );
477 // XXX: remove htmlspecialchars when tal:attributes works with i18n:attributes
478 $nav_urls = array();
479 $nav_urls['mainpage'] = array('href' => htmlspecialchars( $this->makeI18nUrl('mainpage')));
480 $nav_urls['randompage'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Randompage')));
481 $nav_urls['recentchanges'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchanges')));
482 $nav_urls['whatlinkshere'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Whatlinkshere', 'target='.$this->thispage)));
483 $nav_urls['currentevents'] = (wfMsg('currentevents') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('currentevents'))) : false;
484 $nav_urls['portal'] = (wfMsg('portal') != '-') ? array('href' => htmlspecialchars( $this->makeI18nUrl('portal-url'))) : false;
485 $nav_urls['recentchangeslinked'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Recentchangeslinked', 'target='.$this->thispage)));
486 $nav_urls['bugreports'] = array('href' => htmlspecialchars( $this->makeI18nUrl('bugreportspage')));
487 // $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $this->makeI18nUrl('sitesupportpage')));
488 $nav_urls['sitesupport'] = array('href' => htmlspecialchars( $wgSiteSupportPage));
489 $nav_urls['help'] = array('href' => htmlspecialchars( $this->makeI18nUrl('helppage')));
490 $nav_urls['upload'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Upload')));
491 $nav_urls['specialpages'] = array('href' => htmlspecialchars( $this->makeSpecialUrl('Specialpages')));
492
493
494 $id=User::idFromName($wgTitle->getText());
495 $ip=User::isIP($wgTitle->getText());
496
497 if($id || $ip) { # both anons and non-anons have contri list
498 $nav_urls['contributions'] = array(
499 'href' => htmlspecialchars( $this->makeSpecialUrl('Contributions', "target=" . $wgTitle->getPartialURL() ) )
500 );
501 }
502 if ( 0 != $wgUser->getID() ) { # show only to signed in users
503 if($id) { # can only email non-anons
504 $nav_urls['emailuser'] = array(
505 'href' => htmlspecialchars( $this->makeSpecialUrl('Emailuser', "target=" . $wgTitle->getPartialURL() ) )
506 );
507 }
508 }
509
510
511 return $nav_urls;
512 }
513
514 function getNameSpaceWord () {
515 global $wgTitle;
516 switch ($wgTitle->getNamespace()) {
517 case NS_MAIN:
518 case NS_TALK:
519 return wfMsg('nstab-main');
520 case NS_USER:
521 case NS_USER_TALK:
522 return wfMsg('nstab-user');
523 case NS_MEDIA:
524 return wfMsg('nstab-media');
525 case NS_SPECIAL:
526 return wfMsg('nstab-special');
527 case NS_WP:
528 case NS_WP_TALK:
529 return wfMsg('nstab-wp');
530 case NS_IMAGE:
531 case NS_IMAGE_TALK:
532 return wfMsg('nstab-image');
533 case NS_MEDIAWIKI:
534 case NS_MEDIAWIKI_TALK:
535 return wfMsg('nstab-mediawiki');
536 case NS_TEMPLATE:
537 case NS_TEMPLATE_TALK:
538 return wfMsg('nstab-template');
539 case NS_HELP:
540 case NS_HELP_TALK:
541 return wfMsg('nstab-help');
542 case NS_CATEGORY:
543 case NS_CATEGORY_TALK:
544 return wfMsg('nstab-category');
545 default:
546 return wfMsg('nstab-main');
547 }
548 }
549 /* private */ function setupUserCssJs () {
550 global $wgRequest, $wgTitle;
551 $action = $wgRequest->getText('action');
552 if($wgTitle->isCssSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) {
553 // css preview
554 $this->usercss = $wgRequest->getText('wpTextbox1');
555 } else {
556 $this->usercss = '@import url('.
557 $this->makeUrl($this->userpage.'/'.$this->skinname.'.css', 'action=raw&ctype=text/css').');';
558 }
559 if($wgTitle->isJsSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) {
560 # XXX: additional security check/prompt?
561 $this->userjsprev = $wgRequest->getText('wpTextbox1');
562 } else {
563 $this->userjs = $this->makeUrl($this->userpage.'/'.$this->skinname.'.js', 'action=raw&ctype=text/javascript');
564 }
565 }
566 }
567
568 class SkinDaVinci extends SkinPHPTal {
569 function initPage( &$out ) {
570 SkinPHPTal::initPage( $out );
571 $this->skinname = "davinci";
572 }
573 }
574
575 class SkinMono extends SkinPHPTal {
576 function initPage( &$out ) {
577 SkinPHPTal::initPage( $out );
578 $this->skinname = "mono";
579 }
580 }
581
582 class SkinMonoBook extends SkinPHPTal {
583 function initPage( &$out ) {
584 SkinPHPTal::initPage( $out );
585 $this->skinname = "monobook";
586 }
587 }
588
589 ?>