Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -820,6 +820,9 @@ |
821 | 821 | 'powersearch-ns', |
822 | 822 | 'powersearch-redir', |
823 | 823 | 'powersearch-field', |
| 824 | + 'powersearch-togglelabel', |
| 825 | + 'powersearch-toggleall', |
| 826 | + 'powersearch-togglenone', |
824 | 827 | 'search-external', |
825 | 828 | 'searchdisabled', |
826 | 829 | 'googlesearch', |
Index: trunk/phase3/skins/common/search.js |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +// JS specific to Special:Search |
| 3 | + |
| 4 | +// change the search link to what user entered |
| 5 | +function mwSearchHeaderClick(obj){ |
| 6 | + var searchbox = document.getElementById("searchText"); |
| 7 | + if( searchbox == null ) |
| 8 | + searchbox = document.getElementById("powerSearchText"); |
| 9 | + if( searchbox == null) |
| 10 | + return; // should always have either normal or advanced search |
| 11 | + |
| 12 | + var searchterm = searchbox.value; |
| 13 | + var parts = obj.href.split("search="); |
| 14 | + var lastpart = ''; |
| 15 | + if( parts[1].indexOf('&') >= 0 ) |
| 16 | + lastpart = parts[1].substring( parts[1].indexOf('&') ) |
| 17 | + obj.href = parts[0] + "search=" + encodeURIComponent(searchterm) + lastpart; |
| 18 | +} |
| 19 | + |
| 20 | +function mwToggleSearchCheckboxes( btn ) { |
| 21 | + if( !document.getElementById ) return; |
| 22 | + |
| 23 | + var nsInputs = document.getElementById( 'powersearch' ).getElementsByTagName( 'input' ); |
| 24 | + var isChecked = false; |
| 25 | + |
| 26 | + for ( var i = 0; i < nsInputs.length; i++ ) { |
| 27 | + var pattern = /^ns/; |
| 28 | + if ( ( nsInputs[i].type == 'checkbox' ) && ( pattern.test( nsInputs[i].name ) ) ) { |
| 29 | + switch ( btn.value ) { |
| 30 | + case "None": |
| 31 | + if ( nsInputs[i].checked ) { |
| 32 | + nsInputs[i].checked = false; |
| 33 | + } |
| 34 | + break; |
| 35 | + case "All": |
| 36 | + if ( !nsInputs[i].checked ) { |
| 37 | + nsInputs[i].checked = true; |
| 38 | + } |
| 39 | + break; |
| 40 | + } |
| 41 | + } |
| 42 | + } |
| 43 | +} |
Index: trunk/phase3/skins/common/shared.css |
— | — | @@ -123,6 +123,7 @@ |
124 | 124 | .mw-search-results li { |
125 | 125 | padding-bottom: 1em; |
126 | 126 | list-style:none; |
| 127 | + list-style-image:none; |
127 | 128 | } |
128 | 129 | .mw-search-results li a { |
129 | 130 | font-size: 108%; |
— | — | @@ -214,6 +215,23 @@ |
215 | 216 | |
216 | 217 | |
217 | 218 | /* |
| 219 | + * Advanced PowerSearch box |
| 220 | + */ |
| 221 | + |
| 222 | +td#mw-search-togglebox { |
| 223 | + text-align: right; |
| 224 | +} |
| 225 | + |
| 226 | +div#mw-search-redirbox { |
| 227 | + width:100%; |
| 228 | +} |
| 229 | + |
| 230 | +table#mw-search-redirtable { |
| 231 | + width:95%; |
| 232 | +} |
| 233 | + |
| 234 | + |
| 235 | +/* |
218 | 236 | * UserRights stuff |
219 | 237 | */ |
220 | 238 | .mw-userrights-disabled { |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1485,7 +1485,7 @@ |
1486 | 1486 | * to ensure that client-side caches don't keep obsolete copies of global |
1487 | 1487 | * styles. |
1488 | 1488 | */ |
1489 | | -$wgStyleVersion = '220'; |
| 1489 | +$wgStyleVersion = '221'; |
1490 | 1490 | |
1491 | 1491 | |
1492 | 1492 | # Server-side caching: |
Index: trunk/phase3/includes/specials/SpecialSearch.php |
— | — | @@ -322,6 +322,8 @@ |
323 | 323 | } |
324 | 324 | $wgOut->setArticleRelated( false ); |
325 | 325 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
| 326 | + // add javascript specific to special:search |
| 327 | + $wgOut->addScriptFile( 'search.js' ); |
326 | 328 | } |
327 | 329 | |
328 | 330 | /** |
— | — | @@ -535,7 +537,7 @@ |
536 | 538 | $out .= $this->showInterwikiHit( $result, $prev, $terms, $query, $customCaptions ); |
537 | 539 | $prev = $result->getInterwikiPrefix(); |
538 | 540 | } |
539 | | - // FIXME: should support paging in a non-confusing way (not sure how though, maybe via ajax).. |
| 541 | + // TODO: should support paging in a non-confusing way (not sure how though, maybe via ajax).. |
540 | 542 | $out .= "</ul></div>\n"; |
541 | 543 | |
542 | 544 | // convert the whole thing to desired language variant |
— | — | @@ -612,20 +614,32 @@ |
613 | 615 | $namespaces = SearchEngine::searchableNamespaces(); |
614 | 616 | |
615 | 617 | $tables = $this->namespaceTables( $namespaces ); |
616 | | - |
| 618 | + |
| 619 | + // include redirects in the search |
617 | 620 | $redirect = Xml::check( 'redirs', $this->searchRedirects, array( 'value' => '1', 'id' => 'redirs' ) ); |
618 | 621 | $redirectLabel = Xml::label( wfMsg( 'powersearch-redir' ), 'redirs' ); |
619 | | - $searchField = Xml::inputLabel( wfMsg('powersearch-field'), 'search', 'powerSearchText', 50, $term, |
620 | | - array( 'type' => 'text') ); |
621 | | - $searchButton = Xml::submitButton( wfMsg( 'powersearch' ) ) . "\n"; |
622 | | - $searchTitle = SpecialPage::getTitleFor( 'Search' ); |
623 | 622 | |
624 | 623 | $redirectText = ''; |
625 | 624 | // show redirects check only if backend supports it |
626 | 625 | if( $this->searchEngine->acceptListRedirects() ) { |
627 | | - $redirectText = "<p>". $redirect . " " . $redirectLabel ."</p>"; |
| 626 | + $redirectText = "<td id='powersearch-rediropt'>". $redirect . " " . $redirectLabel ."</td>"; |
628 | 627 | } |
| 628 | + |
| 629 | + |
| 630 | + $searchField = Xml::inputLabel( wfMsg( 'powersearch-field' ), 'search', 'powerSearchText', 50, $term, |
| 631 | + array( 'type' => 'text') ); |
629 | 632 | |
| 633 | + // toggle for turning on and off all checkboxes |
| 634 | + $selectOptionsLabel = Xml::label( wfMsg( 'powersearch-togglelabel' ), 'mw-search-togglelabel' ); |
| 635 | + $selectAllButton = Xml::submitButton( wfMsg( 'powersearch-toggleall' ), array( 'id' => 'mw-search-toggleall', 'onclick' => 'mwToggleSearchCheckboxes(this);return false;' ) ); |
| 636 | + $selectNoneButton = Xml::submitButton( wfMsg( 'powersearch-togglenone' ), array( 'id' => 'mw-search-togglenone', 'onclick' => 'mwToggleSearchCheckboxes(this);return false;' ) ); |
| 637 | + $selectOptionsText = "<td id='mw-search-togglebox'>" . $selectOptionsLabel . $selectAllButton . $selectNoneButton . "</td>"; |
| 638 | + |
| 639 | + $searchButton = Xml::submitButton( wfMsg( 'powersearch' ) ) . "\n"; |
| 640 | + $searchTitle = SpecialPage::getTitleFor( 'Search' ); |
| 641 | + |
| 642 | + $optionsText = "<div id='mw-search-redirbox'><table id='mw-search-redirtable'><tr>" . $redirectText . $selectOptionsText . "</tr></table></div>"; |
| 643 | + |
630 | 644 | $out = Xml::openElement( 'form', array( 'id' => 'powersearch', 'method' => 'get', 'action' => $wgScript ) ) . |
631 | 645 | Xml::hidden( 'title', $searchTitle->getPrefixedText() ) . "\n" . |
632 | 646 | "<p>" . |
— | — | @@ -634,8 +648,8 @@ |
635 | 649 | '<input type="hidden" name="advanced" value="'.$this->searchAdvanced."\"/>\n". |
636 | 650 | $tables . |
637 | 651 | "<hr style=\"clear: both;\" />\n". |
638 | | - $redirectText ."\n". |
639 | | - "<div style=\"padding-top:2px;padding-bottom:2px;\">". |
| 652 | + $optionsText . "\n". |
| 653 | + "<div style=\"padding-top:4px;padding-bottom:2px;text-align:center;\">". |
640 | 654 | $searchField . |
641 | 655 | " " . |
642 | 656 | Xml::hidden( 'fulltext', 'Advanced search' ) . "\n" . |
— | — | @@ -691,7 +705,7 @@ |
692 | 706 | if( $this->active == 'default' ) { |
693 | 707 | $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m ); |
694 | 708 | } else { |
695 | | - $out .= $this->makeSearchLink( $bareterm, SearchEngine::defaultNamespaces(), $m, $tt ); |
| 709 | + $out .= $this->makeSearchLink( $bareterm, SearchEngine::defaultNamespaces(), $m, $tt); |
696 | 710 | } |
697 | 711 | $out .= $sep; |
698 | 712 | |
— | — | @@ -777,13 +791,7 @@ |
778 | 792 | $out .= Xml::input( 'search', 50, $term, array( 'type' => 'text', 'id' => 'searchText' ) ) . "\n"; |
779 | 793 | $out .= Xml::hidden( 'fulltext', 'Search' ); |
780 | 794 | $out .= Xml::submitButton( wfMsg( 'searchbutton' ) ); |
781 | | - //$out .= ' (' . wfMsgExt('searchmenu-help',array('parseinline') ) . ')'; |
782 | 795 | $out .= Xml::closeElement( 'form' ); |
783 | | - // Add prefix link for single-namespace searches |
784 | | - $t = Title::newFromText( $term ); |
785 | | - /*if( $t != null && count($this->namespaces) === 1 ) { |
786 | | - $out .= wfMsgExt( 'searchmenu-prefix', array('parseinline'), $term ); |
787 | | - }*/ |
788 | 796 | return $out . $this->didYouMeanHtml; |
789 | 797 | } |
790 | 798 | |
— | — | @@ -799,7 +807,9 @@ |
800 | 808 | $stParams = wfArrayToCGI( array( 'search' => $term, 'fulltext' => wfMsg( 'search' ) ), $opt ); |
801 | 809 | |
802 | 810 | return Xml::element( 'a', |
803 | | - array( 'href'=> $st->getLocalURL( $stParams ), 'title' => $tooltip ), |
| 811 | + array( 'href'=> $st->getLocalURL( $stParams ), 'title' => $tooltip, |
| 812 | + 'onmousedown' => 'mwSearchHeaderClick(this);', |
| 813 | + 'onkeydown' => 'mwSearchHeaderClick(this);'), |
804 | 814 | $label ); |
805 | 815 | } |
806 | 816 | |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1490,6 +1490,9 @@ |
1491 | 1491 | 'powersearch-ns' => 'Search in namespaces:', |
1492 | 1492 | 'powersearch-redir' => 'List redirects', |
1493 | 1493 | 'powersearch-field' => 'Search for', |
| 1494 | +'powersearch-togglelabel' => 'Check: ', |
| 1495 | +'powersearch-toggleall' => 'All', |
| 1496 | +'powersearch-togglenone' => 'None', |
1494 | 1497 | 'search-external' => 'External search', |
1495 | 1498 | 'searchdisabled' => '{{SITENAME}} search is disabled. |
1496 | 1499 | You can search via Google in the meantime. |