Index: trunk/phase3/skins/Vector.php |
— | — | @@ -745,13 +745,14 @@ |
746 | 746 | <input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/> |
747 | 747 | <?php if ( $wgVectorUseSimpleSearch && $wgUser->getOption( 'vector-simplesearch' ) ): ?> |
748 | 748 | <div id="simpleSearch"> |
749 | | - <input id="searchInput" name="search" type="text" <?php echo $this->skin->tooltipAndAccesskey( 'search' ); ?> <?php if( isset( $this->data['search'] ) ): ?> value="<?php $this->text( 'search' ) ?>"<?php endif; ?> /> |
750 | | - <button id="searchButton" type='submit' name='button' <?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?>><img src="<?php echo $this->skin->getSkinStylePath('images/search-' . ( $this->data['rtl'] ? 'rtl' : 'ltr' ) . '.png'); ?>" alt="<?php $this->msg( 'searchbutton' ) ?>" /></button> |
| 749 | + <?php echo $this->makeSearchInput(array( "id" => "searchInput" )); ?> |
| 750 | + <?php echo $this->makeSearchButton("image", array( "id" => "searchButton", |
| 751 | + "src" => $this->skin->getSkinStylePath('images/search-' . ( $this->data['rtl'] ? 'rtl' : 'ltr' ) . '.png') )); ?> |
751 | 752 | </div> |
752 | 753 | <?php else: ?> |
753 | | - <input id="searchInput" name="search" type="text" <?php echo $this->skin->tooltipAndAccesskey( 'search' ); ?> <?php if( isset( $this->data['search'] ) ): ?> value="<?php $this->text( 'search' ) ?>"<?php endif; ?> /> |
754 | | - <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg( 'searcharticle' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> /> |
755 | | - <input type="submit" name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg( 'searchbutton' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> /> |
| 754 | + <?php echo $this->makeSearchInput(array( "id" => "searchInput" )); ?> |
| 755 | + <?php echo $this->makeSearchButton("go", array( "id" => "searchGoButton", "class" => "searchButton" )); ?> |
| 756 | + <?php echo $this->makeSearchButton("fulltext", array( "id" => "mw-searchButton", "class" => "searchButton" )); ?> |
756 | 757 | <?php endif; ?> |
757 | 758 | </form> |
758 | 759 | </div> |
Index: trunk/phase3/skins/MonoBook.php |
— | — | @@ -241,19 +241,15 @@ |
242 | 242 | <div id="searchBody" class="pBody"> |
243 | 243 | <form action="<?php $this->text('wgScript') ?>" id="searchform"> |
244 | 244 | <input type='hidden' name="title" value="<?php $this->text('searchtitle') ?>"/> |
245 | | - <?php |
246 | | - echo Html::input( 'search', |
247 | | - isset( $this->data['search'] ) ? $this->data['search'] : '', 'search', |
248 | | - array( |
249 | | - 'id' => 'searchInput', |
250 | | - 'title' => $this->skin->titleAttrib( 'search' ), |
251 | | - 'accesskey' => $this->skin->accesskey( 'search' ) |
252 | | - ) ); ?> |
| 245 | + <?php echo $this->makeSearchInput(array( "id" => "searchInput" )); ?> |
253 | 246 | |
254 | | - <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> /><?php if ($wgUseTwoButtonsSearchForm) { ?>  |
255 | | - <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> /><?php } else { ?> |
| 247 | + <?php echo $this->makeSearchButton("go", array( "id" => "searchGoButton", "class" => "searchButton" )); |
| 248 | + if ($wgUseTwoButtonsSearchForm): ?>  |
| 249 | + <?php echo $this->makeSearchButton("fulltext", array( "id" => "mw-searchButton", "class" => "searchButton" )); |
| 250 | + else: ?> |
256 | 251 | |
257 | | - <div><a href="<?php $this->text('searchaction') ?>" rel="search"><?php $this->msg('powersearch-legend') ?></a></div><?php } ?> |
| 252 | + <div><a href="<?php $this->text('searchaction') ?>" rel="search"><?php $this->msg('powersearch-legend') ?></a></div><?php |
| 253 | + endif; ?> |
258 | 254 | |
259 | 255 | </form> |
260 | 256 | </div> |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -1355,6 +1355,44 @@ |
1356 | 1356 | return Html::rawElement( isset($options["tag"]) ? $options["tag"] : "li", $attrs, $html ); |
1357 | 1357 | } |
1358 | 1358 | |
| 1359 | + function makeSearchInput($attrs = array()) { |
| 1360 | + $realAttrs = array( |
| 1361 | + "type" => "search", |
| 1362 | + "name" => "search", |
| 1363 | + "value" => isset($this->data['search']) ? $this->data['search'] : '', |
| 1364 | + ); |
| 1365 | + $realAttrs = array_merge($realAttrs, $this->skin->tooltipAndAccesskeyAttribs('search'), $attrs); |
| 1366 | + return Html::element( "input", $realAttrs ); |
| 1367 | + } |
1359 | 1368 | |
| 1369 | + function makeSearchButton($mode, $attrs = array()) { |
| 1370 | + switch($mode) { |
| 1371 | + case "go": |
| 1372 | + case "fulltext": |
| 1373 | + $realAttrs = array( |
| 1374 | + "type" => "submit", |
| 1375 | + "name" => $mode, |
| 1376 | + "value" => $this->translator->translate( $mode == "go" ? "searcharticle" : "searchbutton" ), |
| 1377 | + ); |
| 1378 | + $realAttrs = array_merge($realAttrs, $this->skin->tooltipAndAccesskeyAttribs("search-$mode"), $attrs); |
| 1379 | + return Html::element( "input", $realAttrs ); |
| 1380 | + case "image": |
| 1381 | + $buttonAttrs = array( |
| 1382 | + "type" => "submit", |
| 1383 | + "name" => "button", |
| 1384 | + ); |
| 1385 | + $buttonAttrs = array_merge($buttonAttrs, $this->skin->tooltipAndAccesskeyAttribs("search-fulltext"), $attrs); |
| 1386 | + unset($buttonAttrs["src"]); |
| 1387 | + unset($buttonAttrs["alt"]); |
| 1388 | + $imgAttrs = array( |
| 1389 | + "src" => $attrs["src"], |
| 1390 | + "alt" => isset($attrs["alt"]) ? $attrs["alt"] : $this->translator->translate( "searchbutton" ), |
| 1391 | + ); |
| 1392 | + return Html::rawElement( "button", $buttonAttrs, Html::element( "img", $imgAttrs ) ); |
| 1393 | + default: |
| 1394 | + throw new MWException("Unknown mode passed to BaseTemplate::makeSearchButton"); |
| 1395 | + } |
| 1396 | + } |
| 1397 | + |
1360 | 1398 | } |
1361 | 1399 | |