r68155 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68154‎ | r68155 | r68156 >
Date:07:32, 17 June 2010
Author:raymond
Status:ok
Tags:
Comment:
Add the current limit (manually changed by a user) from the query string to avoid that the limit is lost after clicking Go next time
Modified paths:
  • /trunk/phase3/includes/Pager.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Pager.php
@@ -986,7 +986,14 @@
987987 */
988988 function getLimitSelect() {
989989 global $wgLang;
990 - $s = "<select name=\"limit\">";
 990+
 991+ # Add the current limit from the query string
 992+ # to avoid that the limit is lost after clicking Go next time
 993+ if ( !in_array( $this->mLimit, $this->mLimitsShown ) ) {
 994+ $this->mLimitsShown[] = $this->mLimit;
 995+ sort( $this->mLimitsShown );
 996+ }
 997+ $s = Html::openElement( 'select', array( 'name' => 'limit' ) ) . "\n";
991998 foreach ( $this->mLimitsShown as $key => $value ) {
992999 # The pair is either $index => $limit, in which case the $value
9931000 # will be numeric, or $limit => $text, in which case the $value
@@ -998,10 +1005,9 @@
9991006 $limit = $key;
10001007 $text = $value;
10011008 }
1002 - $selected = ( $limit == $this->mLimit ? 'selected="selected"' : '' );
1003 - $s .= "<option value=\"$limit\" $selected>$text</option>\n";
 1009+ $s .= Xml::option( $text, $limit, $limit == $this->mLimit ) . "\n";
10041010 }
1005 - $s .= "</select>";
 1011+ $s .= Html::closeElement( 'select' );
10061012 return $s;
10071013 }
10081014

Status & tagging log