From bbc07fe776059333076f880a6244001d9da459c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Robert=20Stojni=C4=87?= Date: Sun, 31 May 2009 17:35:08 +0000 Subject: [PATCH] Don't use submit buttons in r51228 for select all/none since that confuses the browser as to which submit button is the main one. Instead use normal html buttons. Also actually work for localized values. --- includes/specials/SpecialSearch.php | 12 ++++++------ skins/common/search.js | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index b554afb695..814dade3ce 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -632,8 +632,12 @@ class SpecialSearch { // toggle for turning on and off all checkboxes $selectOptionsLabel = Xml::label( wfMsg( 'powersearch-togglelabel' ), 'mw-search-togglelabel' ); - $selectAllButton = Xml::submitButton( wfMsg( 'powersearch-toggleall' ), array( 'id' => 'mw-search-toggleall', 'onclick' => 'mwToggleSearchCheckboxes(this);return false;' ) ); - $selectNoneButton = Xml::submitButton( wfMsg( 'powersearch-togglenone' ), array( 'id' => 'mw-search-togglenone', 'onclick' => 'mwToggleSearchCheckboxes(this);return false;' ) ); + $selectAllButton = Xml::openElement('button', array('type'=>'button', 'id' => 'mw-search-toggleall', 'onclick' => 'mwToggleSearchCheckboxes("all");' )) + . wfMsg( 'powersearch-toggleall' ) . Xml::closeElement('button'); + + $selectNoneButton = Xml::openElement('button', array('type'=>'button', 'id' => 'mw-search-togglenone', 'onclick' => 'mwToggleSearchCheckboxes("none");' )) + . wfMsg( 'powersearch-togglenone' ) . Xml::closeElement('button'); + $selectOptionsText = "" . $selectOptionsLabel . $selectAllButton . $selectNoneButton . ""; $searchButton = Xml::submitButton( wfMsg( 'powersearch' ) ) . "\n"; @@ -657,10 +661,6 @@ class SpecialSearch { $searchButton . "". ""; - $t = Title::newFromText( $term ); - /* if( $t != null && count($this->namespaces) === 1 ) { - $out .= wfMsgExt( 'searchmenu-prefix', array('parseinline'), $term ); - } */ return Xml::openElement( 'fieldset', array('id' => 'mw-searchoptions','style' => 'margin:0em;') ) . Xml::element( 'legend', null, wfMsg('powersearch-legend') ) . $out . $this->didYouMeanHtml . diff --git a/skins/common/search.js b/skins/common/search.js index aad9920aee..ea34270b5b 100644 --- a/skins/common/search.js +++ b/skins/common/search.js @@ -28,13 +28,13 @@ function mwToggleSearchCheckboxes( btn ) { for ( var i = 0; i < nsInputs.length; i++ ) { var pattern = /^ns/; if ( ( nsInputs[i].type == 'checkbox' ) && ( pattern.test( nsInputs[i].name ) ) ) { - switch ( btn.value ) { - case "None": + switch ( btn ) { + case "none": if ( nsInputs[i].checked ) { nsInputs[i].checked = false; } break; - case "All": + case "all": if ( !nsInputs[i].checked ) { nsInputs[i].checked = true; } -- 2.20.1