Remove the functionality allowing users to change the default direction; this is...
authorAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 20 Mar 2008 21:49:22 +0000 (21:49 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 20 Mar 2008 21:49:22 +0000 (21:49 +0000)
RELEASE-NOTES
includes/Pager.php
includes/SpecialCategories.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index a64df70..cfa8208 100644 (file)
@@ -49,11 +49,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Add category table to allow better tracking of category membership counts
 ** (bug 1212) Give correct membership counts on the pages of large categories
 ** Use category table for more efficient display of Special:Categories
-** Allow sorting by number of members on Special:Categories
 * (bug 1459) Search for duplicate files by hash: Special:FileDuplicateSearch
-* Allow the user to choose whether to use a descending or ascending sort in
-  AlphabeticPager-based special pages (Categories, Listusers, Protectedpages/
-  titles).
 
 === Bug fixes in 1.13 ===
 
index 422121b..189bd95 100644 (file)
@@ -75,9 +75,8 @@ abstract class IndexPager implements Pager {
         * going backwards, we'll display the last page of results, but the last
         * result will be at the bottom, not the top.
         *
-        * "Default" is really a misnomer here, since now it's possible for the
-        * user to directly modify this with query parameters.  TODO: rename that
-        * to $mDescending, maybe set this to that by reference for compatibility.
+        * Like $mIndexField, $mDefaultDirection will be a single value even if the
+        * class supports multiple default directions for different order types.
         */
        public $mDefaultDirection;
        public $mIsBackwards;
@@ -119,20 +118,11 @@ abstract class IndexPager implements Pager {
                }
 
                if( !isset( $this->mDefaultDirection ) ) {
-                       $dir = $this->getDefaultDirection();
+                       $dir = $this->getDefaultDirections();
                        $this->mDefaultDirection = is_array( $dir )
                                ? $dir[$this->mOrderType]
                                : $dir;
                }
-
-               # FIXME: Can we figure out a less confusing convention than using a
-               # "direction" parameter when we already have "dir" and "order"?
-               if( $this->mRequest->getVal( 'direction' ) == 'asc' ) {
-                       $this->mDefaultDirection = false;
-               }
-               if( $this->mRequest->getVal( 'direction' ) == 'desc' ) {
-                       $this->mDefaultDirection = true;
-               }
        }
 
        /**
@@ -345,7 +335,6 @@ abstract class IndexPager implements Pager {
                        unset( $this->mDefaultQuery['dir'] );
                        unset( $this->mDefaultQuery['offset'] );
                        unset( $this->mDefaultQuery['limit'] );
-                       unset( $this->mDefaultQuery['direction'] );
                        unset( $this->mDefaultQuery['order'] );
                }
                return $this->mDefaultQuery;
@@ -362,7 +351,7 @@ abstract class IndexPager implements Pager {
        }
 
        /**
-        * Get a query array for the prev, next, first and last links.
+        * Get a URL query array for the prev, next, first and last links.
         */
        function getPagingQueries() {
                if ( !$this->mQueryDone ) {
@@ -449,6 +438,9 @@ abstract class IndexPager implements Pager {
         * 'querykey' => 'indexfield' pairs, so that a request with &count=querykey
         * will use indexfield to sort.  In this case, the first returned key is
         * the default.
+        *
+        * Needless to say, it's really not a good idea to use a non-unique index
+        * for this!  That won't page right.
         */
        abstract function getIndexField();
 
@@ -464,12 +456,12 @@ abstract class IndexPager implements Pager {
         * called, for instance if it's statically initialized.  In that case the
         * value of that variable (which must be a boolean) will be used.
         *
-        * Note that despite its name, this does not return the value of the now-
-        * misnamed $this->mDefaultDirection member variable.  That is not a
-        * default, it's the actual direction used.  This is just the default and
-        * can be overridden by user input.
+        * Note that despite its name, this does not return the value of the
+        * $this->mDefaultDirection member variable.  That's the default for this
+        * particular instantiation, which is a single value.  This is the set of
+        * all defaults for the class.
         */
-       protected function getDefaultDirection() { return false; }
+       protected function getDefaultDirections() { return false; }
 }
 
 
@@ -483,7 +475,7 @@ abstract class AlphabeticPager extends IndexPager {
        }
        
        /** 
-        * Shamelessly stolen bits from ReverseChronologicalPager, d
+        * Shamelessly stolen bits from ReverseChronologicalPager,
         * didn't want to do class magic as may be still revamped 
         */
        function getNavigationBar() {
@@ -509,27 +501,6 @@ abstract class AlphabeticPager extends IndexPager {
                        wfMsgHtml( 'viewprevnext', $pagingLinks['prev'],
                        $pagingLinks['next'], $limits );
 
-               /*
-               $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
                        return $this->mNavigationBar;
@@ -558,7 +529,6 @@ abstract class AlphabeticPager extends IndexPager {
                if( $extra !== '' ) {
                        $this->mNavigationBar .= " ($extra)";
                }
-               */
 
                return $this->mNavigationBar;
        }
index 38996dc..a653d2a 100644 (file)
@@ -17,6 +17,9 @@ function wfSpecialCategories() {
 }
 
 /**
+ * TODO: Allow sorting by count.  We need to have a unique index to do this
+ * properly.
+ *
  * @addtogroup SpecialPage
  * @addtogroup Pager
  */
@@ -31,16 +34,18 @@ class CategoryPager extends AlphabeticPager {
        }
        
        function getIndexField() {
-               return array( 'abc' => 'cat_title', 'count' => 'cat_pages' );
+#              return array( 'abc' => 'cat_title', 'count' => 'cat_pages' );
+               return 'cat_title';
        }
 
-       protected function getOrderTypeMessages() {
-               return array( 'abc' => 'special-categories-sort-abc',
-                       'count' => 'special-categories-sort-count' );
-       }
+#      protected function getOrderTypeMessages() {
+#              return array( 'abc' => 'special-categories-sort-abc',
+#                      'count' => 'special-categories-sort-count' );
+#      }
 
-       protected function getDefaultDirection() {
-               return array( 'abc' => false, 'count' => true );
+       protected function getDefaultDirections() {
+#              return array( 'abc' => false, 'count' => true );
+               return false;
        }
        
        /* Override getBody to apply LinksBatch on resultset before actually outputting anything. */
index 45cb2ae..4adff06 100644 (file)
@@ -1729,8 +1729,6 @@ The [http://meta.wikimedia.org/wiki/Help:Job_queue job queue] length is '''\$7''
 'notargettext'                    => 'You have not specified a target page or user to perform this function on.',
 'pager-newer-n'                   => '{{PLURAL:$1|newer 1|newer $1}}',
 'pager-older-n'                   => '{{PLURAL:$1|older 1|older $1}}',
-'pager-sort-asc'                  => 'ascending',
-'pager-sort-desc'                 => 'descending',
 
 # Book sources
 'booksources'               => 'Book sources',
index ef7f956..0c57380 100644 (file)
@@ -1133,8 +1133,6 @@ $wgMessageStructure = array(
                'notargettext',
                'pager-newer-n',
                'pager-older-n',
-               'pager-sort-asc',
-               'pager-sort-desc',
        ),
        'booksources' => array(
                'booksources',