CologneBlue rewrite: remove stuff from pageTitleLinks() that doesn't belong in there
[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 function execute() {
51 $this->html( 'headelement' );
52 echo $this->beforeContent();
53 $this->html( 'bodytext' );
54 echo "\n";
55 echo $this->afterContent();
56 $this->html( 'dataAfterContent' );
57 $this->printTrail();
58 echo "\n</body></html>";
59 }
60
61
62 /**
63 * Language/charset variant links for classic-style skins
64 * @return string
65 */
66 function variantLinks() {
67 $s = '';
68
69 /* show links to different language variants */
70 global $wgDisableLangConversion, $wgLang;
71
72 $title = $this->getSkin()->getTitle();
73 $lang = $title->getPageLanguage();
74 $variants = $lang->getVariants();
75
76 if ( !$wgDisableLangConversion && sizeof( $variants ) > 1
77 && !$title->isSpecialPage() ) {
78 foreach ( $variants as $code ) {
79 $varname = $lang->getVariantname( $code );
80
81 if ( $varname == 'disable' ) {
82 continue;
83 }
84 $s = $wgLang->pipeList( array(
85 $s,
86 '<a href="' . htmlspecialchars( $title->getLocalURL( 'variant=' . $code ) ) . '" lang="' . $code . '" hreflang="' . $code . '">' . htmlspecialchars( $varname ) . '</a>'
87 ) );
88 }
89 }
90
91 return $s;
92 }
93
94 /**
95 * Compatibility for extensions adding functionality through tabs.
96 * Eventually these old skins should be replaced with SkinTemplate-based
97 * versions, sigh...
98 * @return string
99 * @todo Exterminate! ...that, and replace it with normal SkinTemplate stuff
100 */
101 function extensionTabLinks() {
102 $tabs = array();
103 $out = '';
104 $s = array();
105 wfRunHooks( 'SkinTemplateTabs', array( $this->getSkin(), &$tabs ) );
106 foreach ( $tabs as $tab ) {
107 $s[] = Xml::element( 'a',
108 array( 'href' => $tab['href'] ),
109 $tab['text'] );
110 }
111
112 if ( count( $s ) ) {
113 global $wgLang;
114
115 $out = wfMessage( 'pipe-separator' )->escaped();
116 $out .= $wgLang->pipeList( $s );
117 }
118
119 return $out;
120 }
121
122 function otherLanguages() {
123 global $wgOut, $wgLang, $wgHideInterlanguageLinks;
124
125 if ( $wgHideInterlanguageLinks ) {
126 return '';
127 }
128
129 $a = $wgOut->getLanguageLinks();
130
131 if ( 0 == count( $a ) ) {
132 return '';
133 }
134
135 $s = wfMessage( 'otherlanguages' )->text() . wfMessage( 'colon-separator' )->text();
136 $first = true;
137
138 if ( $wgLang->isRTL() ) {
139 $s .= '<span dir="ltr">';
140 }
141
142 foreach ( $a as $l ) {
143 if ( !$first ) {
144 $s .= wfMessage( 'pipe-separator' )->escaped();
145 }
146
147 $first = false;
148
149 $nt = Title::newFromText( $l );
150 $text = Language::fetchLanguageName( $nt->getInterwiki() );
151
152 $s .= Html::element( 'a',
153 array( 'href' => $nt->getFullURL(), 'title' => $nt->getText(), 'class' => "external" ),
154 $text == '' ? $l : $text );
155 }
156
157 if ( $wgLang->isRTL() ) {
158 $s .= '</span>';
159 }
160
161 return $s;
162 }
163
164 function pageTitleLinks() {
165 global $wgOut, $wgUser, $wgRequest, $wgLang;
166
167 $oldid = $wgRequest->getVal( 'oldid' );
168 $diff = $wgRequest->getVal( 'diff' );
169 $action = $wgRequest->getText( 'action' );
170
171 $skin = $this->getSkin();
172 $title = $skin->getTitle();
173
174 $s[] = $this->printableLink();
175 $disclaimer = $skin->disclaimerLink(); # may be empty
176
177 if ( $disclaimer ) {
178 $s[] = $disclaimer;
179 }
180
181 $privacy = $skin->privacyLink(); # may be empty too
182
183 if ( $privacy ) {
184 $s[] = $privacy;
185 }
186
187 return $wgLang->pipeList( $s );
188 }
189
190 function printableLink() {
191 global $wgOut, $wgRequest, $wgLang;
192
193 $s = array();
194
195 if ( !$wgOut->isPrintable() ) {
196 $printurl = htmlspecialchars( $this->getSkin()->getTitle()->getLocalUrl(
197 $wgRequest->appendQueryValue( 'printable', 'yes', true ) ) );
198 $s[] = "<a href=\"$printurl\" rel=\"alternate\">"
199 . wfMessage( 'printableversion' )->text() . '</a>';
200 }
201
202 if ( $wgOut->isSyndicated() ) {
203 foreach ( $wgOut->getSyndicationLinks() as $format => $link ) {
204 $feedurl = htmlspecialchars( $link );
205 $s[] = "<a href=\"$feedurl\" rel=\"alternate\" type=\"application/{$format}+xml\""
206 . " class=\"feedlink\">" . wfMessage( "feed-$format" )->escaped() . "</a>";
207 }
208 }
209 return $wgLang->pipeList( $s );
210 }
211
212 /**
213 * Gets the h1 element with the page title.
214 * @return string
215 */
216 function pageTitle() {
217 global $wgOut;
218 $s = '<h1 class="pagetitle"><span dir="auto">' . $wgOut->getPageTitle() . '</span></h1>';
219 return $s;
220 }
221
222 function pageSubtitle() {
223 global $wgOut;
224
225 $sub = $wgOut->getSubtitle();
226
227 if ( $sub == '' ) {
228 global $wgExtraSubtitle;
229 $sub = wfMessage( 'tagline' )->parse() . $wgExtraSubtitle;
230 }
231
232 $subpages = $this->getSkin()->subPageSubtitle();
233 $sub .= !empty( $subpages ) ? "</p><p class='subpages'>$subpages" : '';
234 $s = "<p class='subtitle'>{$sub}</p>\n";
235
236 return $s;
237 }
238
239 function bottomLinks() {
240 global $wgOut, $wgUser;
241 $sep = wfMessage( 'pipe-separator' )->escaped() . "\n";
242
243 $s = '';
244 if ( $wgOut->isArticleRelated() ) {
245 $element[] = '<strong>' . $this->editThisPage() . '</strong>';
246
247 if ( $wgUser->isLoggedIn() ) {
248 $element[] = $this->watchThisPage();
249 }
250
251 $element[] = $this->talkLink();
252 $element[] = $this->historyLink();
253 $element[] = $this->whatLinksHere();
254 $element[] = $this->watchPageLinksLink();
255
256 $title = $this->getSkin()->getTitle();
257
258 if (
259 $title->getNamespace() == NS_USER ||
260 $title->getNamespace() == NS_USER_TALK
261 ) {
262 $id = User::idFromName( $title->getText() );
263 $ip = User::isIP( $title->getText() );
264
265 # Both anons and non-anons have contributions list
266 if ( $id || $ip ) {
267 $element[] = $this->userContribsLink();
268 }
269
270 if ( $this->getSkin()->showEmailUser( $id ) ) {
271 $element[] = $this->emailUserLink();
272 }
273 }
274
275 $s = implode( $element, $sep );
276
277 if ( $title->getArticleID() ) {
278 $s .= "\n<br />";
279
280 // Delete/protect/move links for privileged users
281 if ( $wgUser->isAllowed( 'delete' ) ) {
282 $s .= $this->deleteThisPage();
283 }
284
285 if ( $wgUser->isAllowed( 'protect' ) ) {
286 $s .= $sep . $this->protectThisPage();
287 }
288
289 if ( $wgUser->isAllowed( 'move' ) ) {
290 $s .= $sep . $this->moveThisPage();
291 }
292 }
293
294 $s .= "<br />\n" . $this->otherLanguages();
295 }
296
297 return $s;
298 }
299
300 function editThisPage() {
301 global $wgOut;
302
303 if ( !$wgOut->isArticleRelated() ) {
304 $s = wfMessage( 'protectedpage' )->text();
305 } else {
306 $title = $this->getSkin()->getTitle();
307 if ( $title->quickUserCan( 'edit' ) && $title->exists() ) {
308 $t = wfMessage( 'editthispage' )->text();
309 } elseif ( $title->quickUserCan( 'create' ) && !$title->exists() ) {
310 $t = wfMessage( 'create-this-page' )->text();
311 } else {
312 $t = wfMessage( 'viewsource' )->text();
313 }
314
315 $s = Linker::linkKnown(
316 $title,
317 $t,
318 array(),
319 $this->getSkin()->editUrlOptions()
320 );
321 }
322
323 return $s;
324 }
325
326 function deleteThisPage() {
327 global $wgUser, $wgRequest;
328
329 $diff = $wgRequest->getVal( 'diff' );
330 $title = $this->getSkin()->getTitle();
331
332 if ( $title->getArticleID() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
333 $t = wfMessage( 'deletethispage' )->text();
334
335 $s = Linker::linkKnown(
336 $title,
337 $t,
338 array(),
339 array( 'action' => 'delete' )
340 );
341 } else {
342 $s = '';
343 }
344
345 return $s;
346 }
347
348 function protectThisPage() {
349 global $wgUser, $wgRequest;
350
351 $diff = $wgRequest->getVal( 'diff' );
352 $title = $this->getSkin()->getTitle();
353
354 if ( $title->getArticleID() && ( ! $diff ) && $wgUser->isAllowed( 'protect' ) ) {
355 if ( $title->isProtected() ) {
356 $text = wfMessage( 'unprotectthispage' )->text();
357 $query = array( 'action' => 'unprotect' );
358 } else {
359 $text = wfMessage( 'protectthispage' )->text();
360 $query = array( 'action' => 'protect' );
361 }
362
363 $s = Linker::linkKnown(
364 $title,
365 $text,
366 array(),
367 $query
368 );
369 } else {
370 $s = '';
371 }
372
373 return $s;
374 }
375
376 function watchThisPage() {
377 global $wgOut, $wgUser;
378
379 // Cache
380 $title = $this->getSkin()->getTitle();
381
382 if ( $wgOut->isArticleRelated() ) {
383 if ( $wgUser->isWatched( $title ) ) {
384 $text = wfMessage( 'unwatchthispage' )->text();
385 $query = array(
386 'action' => 'unwatch',
387 'token' => UnwatchAction::getUnwatchToken( $title, $wgUser ),
388 );
389 $id = 'mw-unwatch-link';
390 } else {
391 $text = wfMessage( 'watchthispage' )->text();
392 $query = array(
393 'action' => 'watch',
394 'token' => WatchAction::getWatchToken( $title, $wgUser ),
395 );
396 $id = 'mw-watch-link';
397 }
398
399 $s = Linker::linkKnown(
400 $title,
401 $text,
402 array( 'id' => $id ),
403 $query
404 );
405 } else {
406 $s = wfMessage( 'notanarticle' )->text();
407 }
408
409 return $s;
410 }
411
412 function moveThisPage() {
413 if ( $this->getSkin()->getTitle()->quickUserCan( 'move' ) ) {
414 return Linker::linkKnown(
415 SpecialPage::getTitleFor( 'Movepage' ),
416 wfMessage( 'movethispage' )->text(),
417 array(),
418 array( 'target' => $this->getSkin()->getTitle()->getPrefixedDBkey() )
419 );
420 } else {
421 // no message if page is protected - would be redundant
422 return '';
423 }
424 }
425
426 function historyLink() {
427 return Linker::link(
428 $this->getSkin()->getTitle(),
429 wfMessage( 'history' )->escaped(),
430 array( 'rel' => 'archives' ),
431 array( 'action' => 'history' )
432 );
433 }
434
435 function whatLinksHere() {
436 return Linker::linkKnown(
437 SpecialPage::getTitleFor( 'Whatlinkshere', $this->getSkin()->getTitle()->getPrefixedDBkey() ),
438 wfMessage( 'whatlinkshere' )->escaped()
439 );
440 }
441
442 function userContribsLink() {
443 return Linker::linkKnown(
444 SpecialPage::getTitleFor( 'Contributions', $this->getSkin()->getTitle()->getDBkey() ),
445 wfMessage( 'contributions' )->escaped()
446 );
447 }
448
449 function emailUserLink() {
450 return Linker::linkKnown(
451 SpecialPage::getTitleFor( 'Emailuser', $this->getSkin()->getTitle()->getDBkey() ),
452 wfMessage( 'emailuser' )->escaped()
453 );
454 }
455
456 function watchPageLinksLink() {
457 global $wgOut;
458
459 if ( !$wgOut->isArticleRelated() ) {
460 return wfMessage( 'parentheses', wfMessage( 'notanarticle' )->text() )->escaped();
461 } else {
462 return Linker::linkKnown(
463 SpecialPage::getTitleFor( 'Recentchangeslinked', $this->getSkin()->getTitle()->getPrefixedDBkey() ),
464 wfMessage( 'recentchangeslinked-toolbox' )->escaped()
465 );
466 }
467 }
468
469 function talkLink() {
470 $title = $this->getSkin()->getTitle();
471 if ( NS_SPECIAL == $title->getNamespace() ) {
472 # No discussion links for special pages
473 return '';
474 }
475
476 $linkOptions = array();
477
478 if ( $title->isTalkPage() ) {
479 $link = $title->getSubjectPage();
480 switch( $link->getNamespace() ) {
481 case NS_MAIN:
482 $text = wfMessage( 'articlepage' );
483 break;
484 case NS_USER:
485 $text = wfMessage( 'userpage' );
486 break;
487 case NS_PROJECT:
488 $text = wfMessage( 'projectpage' );
489 break;
490 case NS_FILE:
491 $text = wfMessage( 'imagepage' );
492 # Make link known if image exists, even if the desc. page doesn't.
493 if ( wfFindFile( $link ) )
494 $linkOptions[] = 'known';
495 break;
496 case NS_MEDIAWIKI:
497 $text = wfMessage( 'mediawikipage' );
498 break;
499 case NS_TEMPLATE:
500 $text = wfMessage( 'templatepage' );
501 break;
502 case NS_HELP:
503 $text = wfMessage( 'viewhelppage' );
504 break;
505 case NS_CATEGORY:
506 $text = wfMessage( 'categorypage' );
507 break;
508 default:
509 $text = wfMessage( 'articlepage' );
510 }
511 } else {
512 $link = $title->getTalkPage();
513 $text = wfMessage( 'talkpage' );
514 }
515
516 $s = Linker::link( $link, $text->text(), array(), array(), $linkOptions );
517
518 return $s;
519 }
520
521 function pageStats() {
522 $ret = array();
523 $items = array( 'viewcount', 'credits', 'lastmod', 'numberofwatchingusers', 'copyright' );
524
525 foreach( $items as $item ) {
526 if ( $this->data[$item] !== false ) {
527 $ret[] = $this->data[$item];
528 }
529 }
530
531 return implode( ' ', $ret );
532 }
533
534
535
536
537
538 /**
539 * @return string
540 */
541 function beforeContent() {
542 $mainPageObj = Title::newMainPage();
543
544 $s = "\n<div id='content'>\n";
545 ob_start();
546 ?>
547 <div id="topbar">
548 <p id="sitetitle">
549 <a href="<?php echo htmlspecialchars( $mainPageObj->getLocalURL() ) ?>">
550 <?php echo wfMessage( 'sitetitle' )->escaped() ?>
551 </a>
552 </p>
553 <p id="sitesub">
554 <?php echo wfMessage( 'sitesubtitle' )->escaped() ?>
555 </p>
556
557 <p id="syslinks">
558 <span><?php echo $this->sysLinks() ?></span>
559 </p>
560 <div id="linkcollection">
561 <div id="langlinks"><?php echo str_replace( '<br />', '', $this->otherLanguages() ) ?></div>
562 <?php echo $this->getSkin()->getCategories() ?>
563 <div id="titlelinks"><?php echo $this->pageTitleLinks() ?></div>
564 <?php if ( $this->data['newtalk'] ) { ?>
565 <div class="usermessage"><strong><?php echo $this->data['newtalk'] ?></strong></div>
566 <?php } ?>
567 </div>
568 </div>
569 <?php
570 $s .= ob_get_contents();
571 ob_end_clean();
572
573 $s .= "\n<div id='article'>";
574
575 $notice = $this->getSkin()->getSiteNotice();
576 if( $notice ) {
577 $s .= "\n<div id='siteNotice'>$notice</div>\n";
578 }
579 $s .= $this->pageTitle();
580 $s .= $this->pageSubtitle() . "\n";
581 return $s;
582 }
583
584 /**
585 * @return string
586 */
587 function afterContent(){
588 $s = "\n</div>\n";
589
590 $s .= "\n<div id='footer'>";
591
592 $s .= $this->bottomLinks();
593 $s .= $this->getSkin()->getLanguage()->pipeList( array(
594 "\n<br />" . Linker::linkKnown(
595 Title::newMainPage()
596 ),
597 $this->getSkin()->aboutLink(),
598 $this->searchForm( 'afterContent' )
599 ) );
600
601 $s .= "\n<br />" . $this->pageStats();
602
603 $s .= "\n</div>\n</div>\n";
604
605 $s .= $this->quickBar();
606 return $s;
607 }
608
609 /**
610 * @return string
611 */
612 function sysLinks() {
613 $li = SpecialPage::getTitleFor( 'Userlogin' );
614 $lo = SpecialPage::getTitleFor( 'Userlogout' );
615
616 $rt = $this->getSkin()->getTitle()->getPrefixedURL();
617 if ( 0 == strcasecmp( urlencode( $lo ), $rt ) ) {
618 $q = array();
619 } else {
620 $q = array( 'returnto' => $rt );
621 }
622
623 $s = array(
624 $this->getSkin()->mainPageLink(),
625 Linker::linkKnown(
626 Title::newFromText( wfMessage( 'aboutpage' )->inContentLanguage()->text() ),
627 wfMessage( 'about' )->text()
628 ),
629 Linker::linkKnown(
630 Title::newFromText( wfMessage( 'helppage' )->inContentLanguage()->text() ),
631 wfMessage( 'help' )->text()
632 ),
633 Linker::linkKnown(
634 Title::newFromText( wfMessage( 'faqpage' )->inContentLanguage()->text() ),
635 wfMessage( 'faq' )->text()
636 ),
637 Linker::specialLink( 'Specialpages' )
638 );
639
640 /* show links to different language variants */
641 if( $this->variantLinks() ) {
642 $s[] = $this->variantLinks();
643 }
644 if( $this->extensionTabLinks() ) {
645 $s[] = $this->extensionTabLinks();
646 }
647 if ( $this->data['loggedin'] ) {
648 $s[] = Linker::linkKnown(
649 $lo,
650 wfMessage( 'logout' )->text(),
651 array(),
652 $q
653 );
654 } else {
655 $s[] = Linker::linkKnown(
656 $li,
657 wfMessage( 'login' )->text(),
658 array(),
659 $q
660 );
661 }
662
663 return $this->getSkin()->getLanguage()->pipeList( $s );
664 }
665
666
667
668
669 /**
670 * @param $heading string
671 * @return string
672 *
673 * @fixed
674 */
675 function menuHead( $heading ) {
676 return "\n<h6>" . htmlspecialchars( $heading ) . "</h6>";
677 }
678
679 /**
680 * Compute the sidebar
681 * @access private
682 *
683 * @return string
684 *
685 * @fixed
686 */
687 function quickBar(){
688 $s = "\n<div id='quickbar'>";
689
690 $sep = "<br />\n";
691
692 $plain_bar = $this->data['sidebar'];
693 $bar = array();
694
695 // Massage the sidebar
696 // We want to place SEARCH at the beginning and a lot of stuff before TOOLBOX (or at the end, if it's missing)
697 $additions_done = false;
698 while ( !$additions_done ) {
699 $bar = array(); // Empty it out
700
701 // Always display search on top
702 $bar['SEARCH'] = true;
703
704 foreach ( $plain_bar as $heading => $links ) {
705 if ( $heading == 'TOOLBOX' ) {
706 if( $links !== NULL ) {
707 // If this is not a toolbox prosthetic we inserted outselves, fill it out
708 $plain_bar['TOOLBOX'] = $this->getToolbox();
709 }
710
711 // And insert the stuff
712
713 // "This page" and "Edit" menus
714 // We need to do some massaging here... we reuse all of the items, except for $...['views']['view'],
715 // as $...['namespaces']['main'] and $...['namespaces']['talk'] together serve the same purpose.
716 // We also don't use $...['variants'], these are displayed in the top menu.
717 $content_navigation = $this->data['content_navigation'];
718 $qbpageoptions = array_merge(
719 $content_navigation['namespaces'],
720 array(
721 'history' => $content_navigation['views']['history'],
722 'watch' => $content_navigation['actions']['watch'],
723 'unwatch' => $content_navigation['actions']['unwatch'],
724 )
725 );
726 $content_navigation['actions']['watch'] = null;
727 $content_navigation['actions']['unwatch'] = null;
728 $qbedit = array_merge(
729 array(
730 'edit' => $content_navigation['views']['edit'],
731 'addsection' => $content_navigation['views']['addsection'],
732 ),
733 $content_navigation['actions']
734 );
735 $bar['qbedit'] = $qbedit;
736 $bar['qbpageoptions'] = $qbpageoptions;
737
738 // Personal tools ("My pages")
739 $bar['qbmyoptions'] = $this->getPersonalTools();
740
741 $additions_done = true;
742 }
743
744 // Re-insert current heading, unless it's SEARCH
745 if ( $heading != 'SEARCH' ) {
746 $bar[$heading] = $plain_bar[$heading];
747 }
748 }
749
750 // If TOOLBOX is missing, $additions_done is still false
751 if ( !$additions_done ) {
752 $plain_bar['TOOLBOX'] = false;
753 }
754 }
755
756 foreach ( $bar as $heading => $links ) {
757 if ( $heading == 'SEARCH' ) {
758 $s .= $this->menuHead( wfMessage( 'qbfind' )->text() );
759 $s .= $this->searchForm( 'sidebar' );
760 } elseif ( $heading == 'LANGUAGES' ) {
761 // discard these; we display languages below page content
762 } else {
763 if ( $links ) {
764 // Use the navigation heading from standard sidebar as the "browse" section
765 if ( $heading == 'navigation' ) {
766 $heading = 'qbbrowse';
767 }
768 if ( $heading == 'TOOLBOX' ) {
769 $heading = 'toolbox';
770 }
771
772 $headingMsg = wfMessage( $heading );
773 $any_link = false;
774 $t = $this->menuHead( $headingMsg->exists() ? $headingMsg->text() : $heading );
775
776 foreach ( $links as $key => $link ) {
777 // Can be empty due to rampant sidebar massaging we're doing above
778 if ( $link ) {
779 $any_link = true;
780 $t .= $this->makeListItem( $key, $link, array( 'tag' => 'span' ) ) . $sep;
781 }
782 }
783
784 if ( $any_link ) {
785 $s .= $t;
786 }
787 }
788 }
789 }
790
791 $s .= $sep . "\n</div>\n";
792 return $s;
793 }
794
795 /**
796 * @param $label string
797 * @return string
798 *
799 * @fixed
800 */
801 function searchForm( $which ) {
802 global $wgUseTwoButtonsSearchForm;
803
804 $search = $this->getSkin()->getRequest()->getText( 'search' );
805 $action = $this->data['searchaction'];
806 $s = "<form id=\"searchform-" . htmlspecialchars($which) . "\" method=\"get\" class=\"inline\" action=\"$action\">";
807 if( $which == 'afterContent' ) {
808 $s .= wfMessage( 'qbfind' )->text() . ": ";
809 }
810
811 $s .= "<input type='text' class=\"mw-searchInput\" name=\"search\" size=\"14\" value=\""
812 . htmlspecialchars( substr( $search, 0, 256 ) ) . "\" />"
813 . ($which == 'afterContent' ? " " : "<br />")
814 . "<input type='submit' class=\"searchButton\" name=\"go\" value=\"" . wfMessage( 'searcharticle' )->escaped() . "\" />";
815
816 if( $wgUseTwoButtonsSearchForm ) {
817 $s .= " <input type='submit' class=\"searchButton\" name=\"fulltext\" value=\"" . wfMessage( 'search' )->escaped() . "\" />\n";
818 } else {
819 $s .= '<div><a href="' . $action . '" rel="search">' . wfMessage( 'powersearch-legend' )->escaped() . "</a></div>\n";
820 }
821
822 $s .= '</form>';
823
824 return $s;
825 }
826 }