r62074 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62073‎ | r62074 | r62075 >
Date:20:35, 6 February 2010
Author:btongminh
Status:ok
Tags:
Comment:
* Show the plain title if no link can be constructed
* (bug 22395) Remember settings in navigation links
Modified paths:
  • /trunk/extensions/GlobalUsage/SpecialGlobalUsage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GlobalUsage/SpecialGlobalUsage.php
@@ -41,11 +41,14 @@
4242 * Shows the search form
4343 */
4444 private function showForm() {
45 - global $wgScript, $wgOut;
 45+ global $wgScript, $wgOut, $wgRequest;
4646
 47+ /* Build form */
4748 $html = Xml::openElement( 'form', array( 'action' => $wgScript ) ) . "\n";
4849 // Name of SpecialPage
4950 $html .= Xml::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n";
 51+ // Limit
 52+ $html .= Xml::hidden( 'limit', $wgRequest->getInt( 'limit', 50 ) );
5053 // Input box with target prefilled if available
5154 $formContent = "\t" . Xml::input( 'target', 40, is_null( $this->target ) ? ''
5255 : $this->target->getText() )
@@ -136,8 +139,10 @@
137140 else
138141 $page = "{$item['namespace']}:{$item['title']}";
139142
140 - return WikiMap::makeForeignLink( $item['wiki'], $page,
 143+ $link = WikiMap::makeForeignLink( $item['wiki'], $page,
141144 str_replace( '_', ' ', $page ) );
 145+ // Return only the title if no link can be constructed
 146+ return $link === false ? $page : $link;
142147 }
143148
144149
@@ -269,6 +274,8 @@
270275 if ( $to ) {
271276 $attr = array( 'title' => $pTitle, 'class' => 'mw-prevlink' );
272277 $q = array( 'limit' => $limit, 'to' => $to, 'target' => $target );
 278+ if ( $this->filterLocal )
 279+ $q['filterlocal'] = '1';
273280 $plink = $skin->link( $title, $prev, $attr, $q );
274281 } else {
275282 $plink = $prev;
@@ -278,6 +285,8 @@
279286 if ( $from ) {
280287 $attr = array( 'title' => $nTitle, 'class' => 'mw-nextlink' );
281288 $q = array( 'limit' => $limit, 'from' => $from, 'target' => $target );
 289+ if ( $this->filterLocal )
 290+ $q['filterlocal'] = '1';
282291 $nlink = $skin->link( $title, $next, $attr, $q );
283292 } else {
284293 $nlink = $next;
@@ -289,6 +298,8 @@
290299 $fmtLimit = $wgLang->formatNum( $num );
291300
292301 $q = array( 'offset' => $offset, 'limit' => $num, 'target' => $target );
 302+ if ( $this->filterLocal )
 303+ $q['filterlocal'] = '1';
293304 $lTitle = wfMsgExt( 'shown-title', array( 'parsemag', 'escape' ), $num );
294305 $attr = array( 'title' => $lTitle, 'class' => 'mw-numlink' );
295306

Status & tagging log