Message info
 
To:mediawiki-cvs@lists.wikimedia.org From:robin@svn.wikimedia.org Subject:[MediaWiki-CVS] SVN: [111886] trunk/extensions/WikimediaIncubator/SpecialSearchWiki.php Date:Sun, 19 Feb 2012 20:18:13 +0000
 

https://www.mediawiki.org/wiki/Special:Code/MediaWiki/111886

Revision: 111886
Author: robin
Date: 2012-02-19 20:18:13 +0000 (Sun, 19 Feb 2012)
Log Message:
-----------
Make it remember &uselang= so search results and info pages can be adapted to one's language

Modified Paths:
--------------
trunk/extensions/WikimediaIncubator/SpecialSearchWiki.php

Modified: trunk/extensions/WikimediaIncubator/SpecialSearchWiki.php
===================================================================
--- trunk/extensions/WikimediaIncubator/SpecialSearchWiki.php 2012-02-19 19:59:18 UTC (rev 111885)
+++ trunk/extensions/WikimediaIncubator/SpecialSearchWiki.php 2012-02-19 20:18:13 UTC (rev 111886)
@@ -29,10 +29,12 @@
$languageQuery = $this->getRequest()->getText( 'searchlanguage', isset( $subpage[1] ) ? $subpage[1] : '' );

# Show form
+ $uselang = $this->getRequest()->getVal( 'uselang' );
$this->getOutput()->addHTML(
Xml::fieldset( wfMessage( 'wminc-searchwiki' )->plain(),
Html::rawElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'wminc-searchwiki-form' ),
Html::hidden( 'title', SpecialPage::getTitleFor( 'SearchWiki' ) ) .
+ ( $uselang ? Html::hidden( 'uselang', $uselang ) : '' ) .
'<p>' . Xml::label( wfMessage( 'wminc-searchwiki-selectproject' )->text(), 'wminc-searchproject' ) .
' ' . $this->makeProjectSelector( $projectQuery ) . '</p>' .
'<p>' . Xml::inputLabel( wfMessage( 'wminc-searchwiki-inputlanguage' )->text(), 'searchlanguage',
@@ -91,7 +93,7 @@
}

if( count( $results ) === 1 ) {
- self::gotoWiki( $matchProject, key( $results ) );
+ $this->gotoWiki( $matchProject, key( $results ) );
} elseif( count( $results ) < 1 ) {
$noresult = Html::element( 'p', array( 'class' => 'error' ), wfMessage( 'wminc-searchwiki-noresults' )->text() );
return $this->getOutput()->addHTML( $noresult );
@@ -108,8 +110,9 @@
protected function goToWiki( $project, $lang ) {
$lang = self::getRootCode( $lang );
$status = IncubatorTest::getDBState( array( 'project' => $project, 'lang' => $lang, 'error' => null ) );
+ $infopageParams = array( 'goto' => 'mainpage', 'uselang' => $this->getRequest()->getVal( 'uselang' ) );
$url = $status == 'existing' ? IncubatorTest::getSubdomain( $lang, $project ) :
- Title::newFromText( 'W' . $project . '/' . $lang )->getFullURL( array( 'goto' => 'mainpage' ) );
+ Title::newFromText( 'W' . $project . '/' . $lang )->getFullURL( $infopageParams );
$this->getOutput()->redirect( $url );
}



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs