Sort log types in Special:Log
authorAntoine Musso <hashar@users.mediawiki.org>
Sat, 17 Feb 2007 13:40:45 +0000 (13:40 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sat, 17 Feb 2007 13:40:45 +0000 (13:40 +0000)
RELEASE-NOTES
includes/SpecialLog.php

index 0e617b0..4945753 100644 (file)
@@ -194,6 +194,7 @@ lighter making things easier to read.
 * (bug 8999) User.php gives "undefined user editcount" PHP notice.
 * (bug 8984) Fix a database error in Special:Recentchangeslinked
   when using the postgre database.
+* Sort log types in Special:Log
 
 
 == Languages updated ==
index 409ca23..8fd8d2c 100644 (file)
@@ -368,11 +368,25 @@ class LogViewer {
         */
        function getTypeMenu() {
                $out = "<select name='type'>\n";
-               foreach( LogPage::validTypes() as $type ) {
+
+               $validTypes = LogPage::validTypes();
+               $m = array(); // Temporary array
+
+               // First pass to load the log names
+               foreach( $validTypes as $type ) {
                        $text = LogPage::logName( $type );
+                       $m[$text] = $type;
+               }
+
+               // Second pass to sort by name
+               ksort($m);
+
+               // Third pass generates sorted XHTML content
+               foreach( $m as $text => $type ) {
                        $selected = ($type == $this->reader->queryType());
                        $out .= Xml::option( $text, $type, $selected ) . "\n";
                }
+
                $out .= '</select>';
                return $out;
        }