r32254 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32253‎ | r32254 | r32255 >
Date:20:54, 20 March 2008
Author:simetrical
Status:old
Tags:
Comment:
Per Brion's suggestion, show the selected options too for the Pager stuff, with no link, just as we do for the other bits.
Modified paths:
  • /trunk/phase3/includes/Pager.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Pager.php
@@ -509,17 +509,25 @@
510510 wfMsgHtml( 'viewprevnext', $pagingLinks['prev'],
511511 $pagingLinks['next'], $limits );
512512
513 - # Which direction should the link go? Opposite of the current.
514 - $dir = $this->mDefaultDirection ? 'asc' : 'desc';
515 - $query = array( 'direction' => $dir );
516 - if( $this->mOrderType !== null ) {
517 - $query['order'] = $this->mOrderType;
 513+ $dirlinks = array();
 514+ # Note for grep: uses pager-sort-asc, pager-sort-desc (each in two
 515+ # places)
 516+ foreach( array( 'asc', 'desc' ) as $dir ) {
 517+ if( ($this->mDefaultDirection ? 'desc' : 'asc' ) == $dir ) {
 518+ # Don't print a link, just some text
 519+ $dirlinks[$dir] = wfMsgHTML( "pager-sort-$dir" );
 520+ } else {
 521+ $query = array( 'direction' => $dir );
 522+ if( $this->mOrderType !== null ) {
 523+ $query['order'] = $this->mOrderType;
 524+ }
 525+ $dirlinks[$dir] = $this->makeLink(
 526+ wfMsgHTML( "pager-sort-$dir" ),
 527+ $query
 528+ );
 529+ }
518530 }
519 - # Note for grep: uses pager-sort-asc, pager-sort-desc
520 - $this->mNavigationBar .= ' (' . $this->makeLink(
521 - wfMsgHTML( "pager-sort-$dir" ),
522 - $query
523 - ) . ')';
 531+ $this->mNavigationBar .= ' (' . implode( ' | ', $dirlinks ) . ')';
524532
525533 if( !is_array( $this->getIndexField() ) ) {
526534 # Early return to avoid undue nesting
@@ -530,17 +538,20 @@
531539 $first = true;
532540 $msgs = $this->getOrderTypeMessages();
533541 foreach( array_keys( $msgs ) as $order ) {
 542+ if( $first ) {
 543+ $first = false;
 544+ } else {
 545+ $extra .= ' | ';
 546+ }
 547+
534548 if( $order == $this->mOrderType ) {
535 - continue;
 549+ $extra .= wfMsgHTML( $msgs[$order] );
 550+ } else {
 551+ $extra .= $this->makeLink(
 552+ wfMsgHTML( $msgs[$order] ),
 553+ array( 'order' => $order )
 554+ );
536555 }
537 - if( !$first ) {
538 - $extra .= ' | ';
539 - $first = false;
540 - }
541 - $extra .= $this->makeLink(
542 - wfMsgHTML( $msgs[$order] ),
543 - array( 'order' => $order )
544 - );
545556 }
546557
547558 if( $extra !== '' ) {

Status & tagging log