Merge "CologneBlue rewrite: adjust the quickbar contents to 2012"
[lhc/web/wiklou.git] / skins / CologneBlue.php
1 <?php
2 /**
3 * Cologne Blue: A nicer-looking alternative to Standard.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @todo document
21 * @file
22 * @ingroup Skins
23 */
24
25 if( !defined( 'MEDIAWIKI' ) ) {
26 die( -1 );
27 }
28
29 /**
30 * @todo document
31 * @ingroup Skins
32 */
33 class SkinCologneBlue extends SkinTemplate {
34 var $skinname = 'cologneblue', $stylename = 'cologneblue',
35 $template = 'CologneBlueTemplate';
36 var $useHeadElement = true;
37
38 /**
39 * @param $out OutputPage
40 */
41 function setupSkinUserCss( OutputPage $out ){
42 $out->addModuleStyles( 'mediawiki.legacy.shared' );
43 $out->addModuleStyles( 'mediawiki.legacy.oldshared' );
44 $out->addModuleStyles( 'skins.cologneblue' );
45 }
46
47 }
48
49 class CologneBlueTemplate extends BaseTemplate {
50 protected $mWatchLinkNum = 0; // Appended to end of watch link id's
51
52 function execute() {
53 $this->html( 'headelement' );
54 echo $this->beforeContent();
55 $this->html( 'bodytext' );
56 echo "\n";
57 echo $this->afterContent();
58 $this->html( 'dataAfterContent' );
59 $this->printTrail();
60 echo "\n</body></html>";
61 }
62
63
64 /**
65 * Language/charset variant links for classic-style skins
66 * @return string
67 */
68 function variantLinks() {
69 $s = '';
70
71 /* show links to different language variants */
72 global $wgDisableLangConversion, $wgLang;
73
74 $title = $this->getSkin()->getTitle();
75 $lang = $title->getPageLanguage();
76 $variants = $lang->getVariants();
77
78 if ( !$wgDisableLangConversion && sizeof( $variants ) > 1
79 && !$title->isSpecialPage() ) {
80 foreach ( $variants as $code ) {
81 $varname = $lang->getVariantname( $code );
82
83 if ( $varname == 'disable' ) {
84 continue;
85 }
86 $s = $wgLang->pipeList( array(
87 $s,
88 '<a href="' . htmlspecialchars( $title->getLocalURL( 'variant=' . $code ) ) . '" lang="' . $code . '" hreflang="' . $code . '">' . htmlspecialchars( $varname ) . '</a>'
89 ) );
90 }
91 }
92
93 return $s;
94 }
95
96 /**
97 * Compatibility for extensions adding functionality through tabs.
98 * Eventually these old skins should be replaced with SkinTemplate-based
99 * versions, sigh...
100 * @return string
101 * @todo Exterminate! ...that, and replace it with normal SkinTemplate stuff
102 */
103 function extensionTabLinks() {
104 $tabs = array();
105 $out = '';
106 $s = array();
107 wfRunHooks( 'SkinTemplateTabs', array( $this->getSkin(), &$tabs ) );
108 foreach ( $tabs as $tab ) {
109 $s[] = Xml::element( 'a',
110 array( 'href' => $tab['href'] ),
111 $tab['text'] );
112 }
113
114 if ( count( $s ) ) {
115 global $wgLang;
116
117 $out = wfMessage( 'pipe-separator' )->escaped();
118 $out .= $wgLang->pipeList( $s );
119 }
120
121 return $out;
122 }
123
124 function otherLanguages() {
125 global $wgOut, $wgLang, $wgHideInterlanguageLinks;
126
127 if ( $wgHideInterlanguageLinks ) {
128 return '';
129 }
130
131 $a = $wgOut->getLanguageLinks();
132
133 if ( 0 == count( $a ) ) {
134 return '';
135 }
136
137 $s = wfMessage( 'otherlanguages' )->text() . wfMessage( 'colon-separator' )->text();
138 $first = true;
139
140 if ( $wgLang->isRTL() ) {
141 $s .= '<span dir="ltr">';
142 }
143
144 foreach ( $a as $l ) {
145 if ( !$first ) {
146 $s .= wfMessage( 'pipe-separator' )->escaped();
147 }
148
149 $first = false;
150
151 $nt = Title::newFromText( $l );
152 $text = Language::fetchLanguageName( $nt->getInterwiki() );
153
154 $s .= Html::element( 'a',
155 array( 'href' => $nt->getFullURL(), 'title' => $nt->getText(), 'class' => "external" ),
156 $text == '' ? $l : $text );
157 }
158
159 if ( $wgLang->isRTL() ) {
160 $s .= '</span>';
161 }
162
163 return $s;
164 }
165
166 function pageTitleLinks() {
167 global $wgOut, $wgUser, $wgRequest, $wgLang;
168
169 $oldid = $wgRequest->getVal( 'oldid' );
170 $diff = $wgRequest->getVal( 'diff' );
171 $action = $wgRequest->getText( 'action' );
172
173 $skin = $this->getSkin();
174 $title = $skin->getTitle();
175
176 $s[] = $this->printableLink();
177 $disclaimer = $skin->disclaimerLink(); # may be empty
178
179 if ( $disclaimer ) {
180 $s[] = $disclaimer;
181 }
182
183 $privacy = $skin->privacyLink(); # may be empty too
184
185 if ( $privacy ) {
186 $s[] = $privacy;
187 }
188
189 if ( $wgOut->isArticleRelated() ) {
190 if ( $title->getNamespace() == NS_FILE ) {
191 $image = wfFindFile( $title );
192
193 if ( $image ) {
194 $href = $image->getURL();
195 $s[] = Html::element( 'a', array( 'href' => $href,
196 'title' => $href ), $title->getText() );
197
198 }
199 }
200 }
201
202 if ( 'history' == $action || isset( $diff ) || isset( $oldid ) ) {
203 $s[] .= Linker::linkKnown(
204 $title,
205 wfMessage( 'currentrev' )->text()
206 );
207 }
208
209 if ( $wgUser->getNewtalk() ) {
210 # do not show "You have new messages" text when we are viewing our
211 # own talk page
212 if ( !$title->equals( $wgUser->getTalkPage() ) ) {
213 $tl = Linker::linkKnown(
214 $wgUser->getTalkPage(),
215 wfMessage( 'newmessageslink' )->escaped(),
216 array(),
217 array( 'redirect' => 'no' )
218 );
219
220 $dl = Linker::linkKnown(
221 $wgUser->getTalkPage(),
222 wfMessage( 'newmessagesdifflink' )->escaped(),
223 array(),
224 array( 'diff' => 'cur' )
225 );
226 $s[] = '<strong>' . wfMessage( 'youhavenewmessages', $tl, $dl )->text() . '</strong>';
227 # disable caching
228 $wgOut->setSquidMaxage( 0 );
229 $wgOut->enableClientCache( false );
230 }
231 }
232
233 $undelete = $skin->getUndeleteLink();
234
235 if ( !empty( $undelete ) ) {
236 $s[] = $undelete;
237 }
238
239 return $wgLang->pipeList( $s );
240 }
241
242 function printableLink() {
243 global $wgOut, $wgRequest, $wgLang;
244
245 $s = array();
246
247 if ( !$wgOut->isPrintable() ) {
248 $printurl = htmlspecialchars( $this->getSkin()->getTitle()->getLocalUrl(
249 $wgRequest->appendQueryValue( 'printable', 'yes', true ) ) );
250 $s[] = "<a href=\"$printurl\" rel=\"alternate\">"
251 . wfMessage( 'printableversion' )->text() . '</a>';
252 }
253
254 if ( $wgOut->isSyndicated() ) {
255 foreach ( $wgOut->getSyndicationLinks() as $format => $link ) {
256 $feedurl = htmlspecialchars( $link );
257 $s[] = "<a href=\"$feedurl\" rel=\"alternate\" type=\"application/{$format}+xml\""
258 . " class=\"feedlink\">" . wfMessage( "feed-$format" )->escaped() . "</a>";
259 }
260 }
261 return $wgLang->pipeList( $s );
262 }
263
264 /**
265 * Gets the h1 element with the page title.
266 * @return string
267 */
268 function pageTitle() {
269 global $wgOut;
270 $s = '<h1 class="pagetitle"><span dir="auto">' . $wgOut->getPageTitle() . '</span></h1>';
271 return $s;
272 }
273
274 function pageSubtitle() {
275 global $wgOut;
276
277 $sub = $wgOut->getSubtitle();
278
279 if ( $sub == '' ) {
280 global $wgExtraSubtitle;
281 $sub = wfMessage( 'tagline' )->parse() . $wgExtraSubtitle;
282 }
283
284 $subpages = $this->getSkin()->subPageSubtitle();
285 $sub .= !empty( $subpages ) ? "</p><p class='subpages'>$subpages" : '';
286 $s = "<p class='subtitle'>{$sub}</p>\n";
287
288 return $s;
289 }
290
291 function bottomLinks() {
292 global $wgOut, $wgUser;
293 $sep = wfMessage( 'pipe-separator' )->escaped() . "\n";
294
295 $s = '';
296 if ( $wgOut->isArticleRelated() ) {
297 $element[] = '<strong>' . $this->editThisPage() . '</strong>';
298
299 if ( $wgUser->isLoggedIn() ) {
300 $element[] = $this->watchThisPage();
301 }
302
303 $element[] = $this->talkLink();
304 $element[] = $this->historyLink();
305 $element[] = $this->whatLinksHere();
306 $element[] = $this->watchPageLinksLink();
307
308 $title = $this->getSkin()->getTitle();
309
310 if (
311 $title->getNamespace() == NS_USER ||
312 $title->getNamespace() == NS_USER_TALK
313 ) {
314 $id = User::idFromName( $title->getText() );
315 $ip = User::isIP( $title->getText() );
316
317 # Both anons and non-anons have contributions list
318 if ( $id || $ip ) {
319 $element[] = $this->userContribsLink();
320 }
321
322 if ( $this->getSkin()->showEmailUser( $id ) ) {
323 $element[] = $this->emailUserLink();
324 }
325 }
326
327 $s = implode( $element, $sep );
328
329 if ( $title->getArticleID() ) {
330 $s .= "\n<br />";
331
332 // Delete/protect/move links for privileged users
333 if ( $wgUser->isAllowed( 'delete' ) ) {
334 $s .= $this->deleteThisPage();
335 }
336
337 if ( $wgUser->isAllowed( 'protect' ) ) {
338 $s .= $sep . $this->protectThisPage();
339 }
340
341 if ( $wgUser->isAllowed( 'move' ) ) {
342 $s .= $sep . $this->moveThisPage();
343 }
344 }
345
346 $s .= "<br />\n" . $this->otherLanguages();
347 }
348
349 return $s;
350 }
351
352 function editThisPage() {
353 global $wgOut;
354
355 if ( !$wgOut->isArticleRelated() ) {
356 $s = wfMessage( 'protectedpage' )->text();
357 } else {
358 $title = $this->getSkin()->getTitle();
359 if ( $title->quickUserCan( 'edit' ) && $title->exists() ) {
360 $t = wfMessage( 'editthispage' )->text();
361 } elseif ( $title->quickUserCan( 'create' ) && !$title->exists() ) {
362 $t = wfMessage( 'create-this-page' )->text();
363 } else {
364 $t = wfMessage( 'viewsource' )->text();
365 }
366
367 $s = Linker::linkKnown(
368 $title,
369 $t,
370 array(),
371 $this->getSkin()->editUrlOptions()
372 );
373 }
374
375 return $s;
376 }
377
378 function deleteThisPage() {
379 global $wgUser, $wgRequest;
380
381 $diff = $wgRequest->getVal( 'diff' );
382 $title = $this->getSkin()->getTitle();
383
384 if ( $title->getArticleID() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
385 $t = wfMessage( 'deletethispage' )->text();
386
387 $s = Linker::linkKnown(
388 $title,
389 $t,
390 array(),
391 array( 'action' => 'delete' )
392 );
393 } else {
394 $s = '';
395 }
396
397 return $s;
398 }
399
400 function protectThisPage() {
401 global $wgUser, $wgRequest;
402
403 $diff = $wgRequest->getVal( 'diff' );
404 $title = $this->getSkin()->getTitle();
405
406 if ( $title->getArticleID() && ( ! $diff ) && $wgUser->isAllowed( 'protect' ) ) {
407 if ( $title->isProtected() ) {
408 $text = wfMessage( 'unprotectthispage' )->text();
409 $query = array( 'action' => 'unprotect' );
410 } else {
411 $text = wfMessage( 'protectthispage' )->text();
412 $query = array( 'action' => 'protect' );
413 }
414
415 $s = Linker::linkKnown(
416 $title,
417 $text,
418 array(),
419 $query
420 );
421 } else {
422 $s = '';
423 }
424
425 return $s;
426 }
427
428 function watchThisPage() {
429 global $wgOut, $wgUser;
430 ++$this->mWatchLinkNum;
431
432 // Cache
433 $title = $this->getSkin()->getTitle();
434
435 if ( $wgOut->isArticleRelated() ) {
436 if ( $wgUser->isWatched( $title ) ) {
437 $text = wfMessage( 'unwatchthispage' )->text();
438 $query = array(
439 'action' => 'unwatch',
440 'token' => UnwatchAction::getUnwatchToken( $title, $wgUser ),
441 );
442 $id = 'mw-unwatch-link' . $this->mWatchLinkNum;
443 } else {
444 $text = wfMessage( 'watchthispage' )->text();
445 $query = array(
446 'action' => 'watch',
447 'token' => WatchAction::getWatchToken( $title, $wgUser ),
448 );
449 $id = 'mw-watch-link' . $this->mWatchLinkNum;
450 }
451
452 $s = Linker::linkKnown(
453 $title,
454 $text,
455 array( 'id' => $id ),
456 $query
457 );
458 } else {
459 $s = wfMessage( 'notanarticle' )->text();
460 }
461
462 return $s;
463 }
464
465 function moveThisPage() {
466 if ( $this->getSkin()->getTitle()->quickUserCan( 'move' ) ) {
467 return Linker::linkKnown(
468 SpecialPage::getTitleFor( 'Movepage' ),
469 wfMessage( 'movethispage' )->text(),
470 array(),
471 array( 'target' => $this->getSkin()->getTitle()->getPrefixedDBkey() )
472 );
473 } else {
474 // no message if page is protected - would be redundant
475 return '';
476 }
477 }
478
479 function historyLink() {
480 return Linker::link(
481 $this->getSkin()->getTitle(),
482 wfMessage( 'history' )->escaped(),
483 array( 'rel' => 'archives' ),
484 array( 'action' => 'history' )
485 );
486 }
487
488 function whatLinksHere() {
489 return Linker::linkKnown(
490 SpecialPage::getTitleFor( 'Whatlinkshere', $this->getSkin()->getTitle()->getPrefixedDBkey() ),
491 wfMessage( 'whatlinkshere' )->escaped()
492 );
493 }
494
495 function userContribsLink() {
496 return Linker::linkKnown(
497 SpecialPage::getTitleFor( 'Contributions', $this->getSkin()->getTitle()->getDBkey() ),
498 wfMessage( 'contributions' )->escaped()
499 );
500 }
501
502 function emailUserLink() {
503 return Linker::linkKnown(
504 SpecialPage::getTitleFor( 'Emailuser', $this->getSkin()->getTitle()->getDBkey() ),
505 wfMessage( 'emailuser' )->escaped()
506 );
507 }
508
509 function watchPageLinksLink() {
510 global $wgOut;
511
512 if ( !$wgOut->isArticleRelated() ) {
513 return wfMessage( 'parentheses', wfMessage( 'notanarticle' )->text() )->escaped();
514 } else {
515 return Linker::linkKnown(
516 SpecialPage::getTitleFor( 'Recentchangeslinked', $this->getSkin()->getTitle()->getPrefixedDBkey() ),
517 wfMessage( 'recentchangeslinked-toolbox' )->escaped()
518 );
519 }
520 }
521
522 function talkLink() {
523 $title = $this->getSkin()->getTitle();
524 if ( NS_SPECIAL == $title->getNamespace() ) {
525 # No discussion links for special pages
526 return '';
527 }
528
529 $linkOptions = array();
530
531 if ( $title->isTalkPage() ) {
532 $link = $title->getSubjectPage();
533 switch( $link->getNamespace() ) {
534 case NS_MAIN:
535 $text = wfMessage( 'articlepage' );
536 break;
537 case NS_USER:
538 $text = wfMessage( 'userpage' );
539 break;
540 case NS_PROJECT:
541 $text = wfMessage( 'projectpage' );
542 break;
543 case NS_FILE:
544 $text = wfMessage( 'imagepage' );
545 # Make link known if image exists, even if the desc. page doesn't.
546 if ( wfFindFile( $link ) )
547 $linkOptions[] = 'known';
548 break;
549 case NS_MEDIAWIKI:
550 $text = wfMessage( 'mediawikipage' );
551 break;
552 case NS_TEMPLATE:
553 $text = wfMessage( 'templatepage' );
554 break;
555 case NS_HELP:
556 $text = wfMessage( 'viewhelppage' );
557 break;
558 case NS_CATEGORY:
559 $text = wfMessage( 'categorypage' );
560 break;
561 default:
562 $text = wfMessage( 'articlepage' );
563 }
564 } else {
565 $link = $title->getTalkPage();
566 $text = wfMessage( 'talkpage' );
567 }
568
569 $s = Linker::link( $link, $text->text(), array(), array(), $linkOptions );
570
571 return $s;
572 }
573
574 function pageStats() {
575 $ret = array();
576 $items = array( 'viewcount', 'credits', 'lastmod', 'numberofwatchingusers', 'copyright' );
577
578 foreach( $items as $item ) {
579 if ( $this->data[$item] !== false ) {
580 $ret[] = $this->data[$item];
581 }
582 }
583
584 return implode( ' ', $ret );
585 }
586
587
588
589
590
591 /**
592 * @return string
593 */
594 function beforeContent() {
595 $mainPageObj = Title::newMainPage();
596
597 $s = "\n<div id='content'>\n<div id='topbar'>" .
598 '<table style="width: 100%;" cellspacing="0" cellpadding="8"><tr>';
599
600 $s .= '<td class="top" nowrap="nowrap">';
601 $s .= '<a href="' . htmlspecialchars( $mainPageObj->getLocalURL() ) . '">';
602 $s .= '<span id="sitetitle">' . wfMessage( 'sitetitle' )->escaped() . '</span></a>';
603
604 $s .= '</td><td class="top" id="top-syslinks" style="width: 100%;">';
605 $s .= $this->sysLinks();
606 $s .= '</td></tr><tr><td class="top-subheader">';
607
608 $s .= '<font size="-1"><span id="sitesub">';
609 $s .= wfMessage( 'sitesubtitle' )->escaped() . '</span></font>';
610 $s .= '</td><td class="top-linkcollection">';
611
612 $s .= '<font size="-1"><span id="langlinks">';
613 $s .= str_replace( '<br />', '', $this->otherLanguages() );
614
615 $s .= $this->getSkin()->getCategories();
616
617 $s .= '<br />' . $this->pageTitleLinks();
618 $s .= '</span></font>';
619
620 $s .= "</td></tr></table>\n";
621
622 $s .= "\n</div>\n<div id='article'>";
623
624 $notice = $this->getSkin()->getSiteNotice();
625 if( $notice ) {
626 $s .= "\n<div id='siteNotice'>$notice</div>\n";
627 }
628 $s .= $this->pageTitle();
629 $s .= $this->pageSubtitle() . "\n";
630 return $s;
631 }
632
633 /**
634 * @return string
635 */
636 function afterContent(){
637 $s = "\n</div><br clear='all' />\n";
638
639 $s .= "\n<div id='footer'>";
640 $s .= '<table style="width: 98%;" cellspacing="0"><tr>';
641
642 $s .= '<td class="bottom">';
643
644 $s .= $this->bottomLinks();
645 $s .= $this->getSkin()->getLanguage()->pipeList( array(
646 "\n<br />" . Linker::linkKnown(
647 Title::newMainPage()
648 ),
649 $this->getSkin()->aboutLink(),
650 $this->searchForm( 'afterContent' )
651 ) );
652
653 $s .= "\n<br />" . $this->pageStats();
654
655 $s .= '</td>';
656 $s .= "</tr></table>\n</div>\n</div>\n";
657
658 $s .= $this->quickBar();
659 return $s;
660 }
661
662 /**
663 * @return string
664 */
665 function sysLinks() {
666 $li = SpecialPage::getTitleFor( 'Userlogin' );
667 $lo = SpecialPage::getTitleFor( 'Userlogout' );
668
669 $rt = $this->getSkin()->getTitle()->getPrefixedURL();
670 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
671 $q = array();
672 } else {
673 $q = array( 'returnto' => $rt );
674 }
675
676 $s = array(
677 $this->getSkin()->mainPageLink(),
678 Linker::linkKnown(
679 Title::newFromText( wfMessage( 'aboutpage' )->inContentLanguage()->text() ),
680 wfMessage( 'about' )->text()
681 ),
682 Linker::linkKnown(
683 Title::newFromText( wfMessage( 'helppage' )->inContentLanguage()->text() ),
684 wfMessage( 'help' )->text()
685 ),
686 Linker::linkKnown(
687 Title::newFromText( wfMessage( 'faqpage' )->inContentLanguage()->text() ),
688 wfMessage( 'faq' )->text()
689 ),
690 Linker::specialLink( 'Specialpages' )
691 );
692
693 /* show links to different language variants */
694 if( $this->variantLinks() ) {
695 $s[] = $this->variantLinks();
696 }
697 if( $this->extensionTabLinks() ) {
698 $s[] = $this->extensionTabLinks();
699 }
700 if ( $this->data['loggedin'] ) {
701 $s[] = Linker::linkKnown(
702 $lo,
703 wfMessage( 'logout' )->text(),
704 array(),
705 $q
706 );
707 } else {
708 $s[] = Linker::linkKnown(
709 $li,
710 wfMessage( 'login' )->text(),
711 array(),
712 $q
713 );
714 }
715
716 return $this->getSkin()->getLanguage()->pipeList( $s );
717 }
718
719
720
721
722 /**
723 * @param $heading string
724 * @return string
725 */
726 function menuHead( $heading ) {
727 return "\n<h6>" . htmlspecialchars( $heading ) . "</h6>";
728 }
729
730 /**
731 * Compute the sidebar
732 * @access private
733 *
734 * @return string
735 */
736 function quickBar(){
737 $s = "\n<div id='quickbar'>";
738
739 $sep = "<br />\n";
740
741 $bar = $this->data['sidebar'];
742
743 // Always display search on top
744 $s .= $this->menuHead( wfMessage( 'qbfind' )->text() );
745 $s .= $this->searchForm( 'sidebar' );
746
747 // Populate the toolbox
748 if ( isset( $bar['TOOLBOX'] ) ) {
749 $bar['TOOLBOX'] = $this->getToolbox();
750 }
751
752 foreach ( $bar as $heading => $browseLinks ) {
753 if ( $heading == 'SEARCH' || $heading == 'LANGUAGES' ) {
754 // discard these:
755 // * we display search unconditionally, on top
756 // * we display languages below page content
757 } else {
758 // Use the navigation heading from standard sidebar as the "browse" section
759 if ( $heading == 'navigation' ) {
760 $heading = 'qbbrowse';
761 }
762
763 if ( $heading == 'TOOLBOX' ) {
764 $heading = 'toolbox';
765 }
766
767 $headingMsg = wfMessage( $heading );
768 $s .= $this->menuHead( $headingMsg->exists() ? $headingMsg->text() : $heading );
769
770 if( is_array( $browseLinks ) ) {
771 foreach ( $browseLinks as $key => $link ) {
772 $s .= $this->makeLink( $key, $link ) . $sep;
773 }
774 }
775 }
776 }
777
778 $user = $this->getSkin()->getUser();
779
780 if ( $this->data['isarticle'] ) {
781 $s .= $this->menuHead( wfMessage( 'qbedit' )->text() );
782 $s .= '<strong>' . $this->editThisPage() . '</strong>';
783
784 $s .= $sep . Linker::linkKnown(
785 Title::newFromText( wfMessage( 'edithelppage' )->inContentLanguage()->text() ),
786 wfMessage( 'edithelp' )->text()
787 );
788
789 if( $this->data['loggedin'] ) {
790 $s .= $sep . $this->moveThisPage();
791 }
792 if ( $user->isAllowed( 'delete' ) ) {
793 $dtp = $this->deleteThisPage();
794 if ( $dtp != '' ) {
795 $s .= $sep . $dtp;
796 }
797 }
798 if ( $user->isAllowed( 'protect' ) ) {
799 $ptp = $this->protectThisPage();
800 if ( $ptp != '' ) {
801 $s .= $sep . $ptp;
802 }
803 }
804 $s .= $sep;
805
806 $s .= $this->menuHead( wfMessage( 'qbpageoptions' )->text() );
807 $s .= $this->talkLink()
808 . $sep . $this->historyLink()
809 . $sep . $this->printableLink();
810 if ( $this->data['loggedin'] ) {
811 $s .= $sep . $this->watchThisPage();
812 }
813
814 $s .= $sep;
815
816 }
817
818 $s .= $this->menuHead( wfMessage( 'qbmyoptions' )->text() );
819 if ( $this->data['loggedin'] ) {
820 $tl = Linker::linkKnown(
821 $user->getTalkPage(),
822 wfMessage( 'mytalk' )->escaped()
823 );
824 if ( $user->getNewtalk() ) {
825 $tl .= ' *';
826 }
827
828 $s .= Linker::linkKnown(
829 $user->getUserPage(),
830 wfMessage( 'mypage' )->escaped()
831 ) . $sep . $tl . $sep . Linker::specialLink( 'Watchlist' )
832 . $sep .
833 Linker::linkKnown(
834 SpecialPage::getSafeTitleFor( 'Contributions', $user->getName() ),
835 wfMessage( 'mycontris' )->escaped()
836 ) . $sep . Linker::specialLink( 'Preferences' )
837 . $sep . Linker::specialLink( 'Userlogout' );
838 } else {
839 $s .= Linker::specialLink( 'Userlogin' );
840 }
841
842 $s .= $sep . "\n</div>\n";
843 return $s;
844 }
845
846 /**
847 * @param $label string
848 * @return string
849 *
850 * @fixed
851 */
852 function searchForm( $which ) {
853 global $wgUseTwoButtonsSearchForm;
854
855 $search = $this->getSkin()->getRequest()->getText( 'search' );
856 $action = $this->data['searchaction'];
857 $s = "<form id=\"searchform-" . htmlspecialchars($which) . "\" method=\"get\" class=\"inline\" action=\"$action\">";
858 if( $which == 'afterContent' ) {
859 $s .= wfMessage( 'qbfind' )->text() . ": ";
860 }
861
862 $s .= "<input type='text' class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
863 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" />"
864 . ($which == 'afterContent' ? " " : "<br />")
865 . "<input type='submit' class=\"searchButton\" name=\"go\" value=\"" . wfMessage( 'searcharticle' )->escaped() . "\" />";
866
867 if( $wgUseTwoButtonsSearchForm ) {
868 $s .= " <input type='submit' class=\"searchButton\" name=\"fulltext\" value=\"" . wfMessage( 'search' )->escaped() . "\" />\n";
869 } else {
870 $s .= '<div><a href="' . $action . '" rel="search">' . wfMessage( 'powersearch-legend' )->escaped() . "</a></div>\n";
871 }
872
873 $s .= '</form>';
874
875 return $s;
876 }
877 }