Per Brion's suggestion, show the selected options too for the Pager stuff, with no...
authorAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 20 Mar 2008 20:54:29 +0000 (20:54 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 20 Mar 2008 20:54:29 +0000 (20:54 +0000)
includes/Pager.php

index fafbd9c..fdd883a 100644 (file)
@@ -509,17 +509,25 @@ abstract class AlphabeticPager extends IndexPager {
                        wfMsgHtml( 'viewprevnext', $pagingLinks['prev'],
                        $pagingLinks['next'], $limits );
 
-               # Which direction should the link go?  Opposite of the current.
-               $dir = $this->mDefaultDirection ? 'asc' : 'desc';
-               $query = array( 'direction' => $dir );
-               if( $this->mOrderType !== null ) {
-                       $query['order'] = $this->mOrderType;
-               }
-               # Note for grep: uses pager-sort-asc, pager-sort-desc
-               $this->mNavigationBar .= ' (' . $this->makeLink(
-                       wfMsgHTML( "pager-sort-$dir" ),
-                       $query
-               ) . ')';
+               $dirlinks = array();
+               # Note for grep: uses pager-sort-asc, pager-sort-desc (each in two
+               # places)
+               foreach( array( 'asc', 'desc' ) as $dir ) {
+                       if( ($this->mDefaultDirection ? 'desc' : 'asc' ) == $dir ) {
+                               # Don't print a link, just some text
+                               $dirlinks[$dir] = wfMsgHTML( "pager-sort-$dir" );
+                       } else {
+                               $query = array( 'direction' => $dir );
+                               if( $this->mOrderType !== null ) {
+                                       $query['order'] = $this->mOrderType;
+                               }
+                               $dirlinks[$dir] = $this->makeLink(
+                                       wfMsgHTML( "pager-sort-$dir" ),
+                                       $query
+                               );
+                       }
+               }
+               $this->mNavigationBar .= ' (' . implode( ' | ', $dirlinks ) . ')';
 
                if( !is_array( $this->getIndexField() ) ) {
                        # Early return to avoid undue nesting
@@ -530,17 +538,20 @@ abstract class AlphabeticPager extends IndexPager {
                $first = true;
                $msgs = $this->getOrderTypeMessages();
                foreach( array_keys( $msgs ) as $order ) {
-                       if( $order == $this->mOrderType ) {
-                               continue;
-                       }
-                       if( !$first ) {
-                               $extra .= ' | ';
+                       if( $first ) {
                                $first = false;
+                       } else {
+                               $extra .= ' | ';
+                       }
+                       
+                       if( $order == $this->mOrderType ) {
+                               $extra .= wfMsgHTML( $msgs[$order] );
+                       } else {
+                               $extra .= $this->makeLink(
+                                       wfMsgHTML( $msgs[$order] ),
+                                       array( 'order' => $order )
+                               );
                        }
-                       $extra .= $this->makeLink(
-                               wfMsgHTML( $msgs[$order] ),
-                               array( 'order' => $order )
-                       );
                }
 
                if( $extra !== '' ) {