* Displaying namespace subheadings on Special:Watchlist/edit
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Tue, 21 Jun 2005 15:00:09 +0000 (15:00 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Tue, 21 Jun 2005 15:00:09 +0000 (15:00 +0000)
RELEASE-NOTES
includes/SpecialWatchlist.php

index 36c3e13..a54f75b 100644 (file)
@@ -312,6 +312,7 @@ Various bugfixes, small features, and a few experimental things:
 * (bug 2467) Added a Turkish language file
 * Fixed a bug in Special:Contributions that caused the namespace selection to
   be forgotten between submits
+* Special:Watchlist/edit now has namespace subheadings
 
 === Caveats ===
 
index 97093d0..9e09272 100644 (file)
@@ -124,8 +124,7 @@ function wfSpecialWatchlist( $par ) {
 
                $wgOut->addHTML( '<form action=\'' .
                        $specialTitle->escapeLocalUrl( 'action=submit' ) .
-                       "' method='post'>\n" .
-                       "<ul>\n" );
+                       "' method='post'>\n" );
 
 #              Patch A2
 #              The following was proposed by KTurner 07.11.2004 to T.Gries
@@ -134,21 +133,40 @@ function wfSpecialWatchlist( $par ) {
 
                $res = $dbr->query( $sql, $fname );
                $sk = $wgUser->getSkin();
+
+               $list = array();
                while( $s = $dbr->fetchObject( $res ) ) {
-                       $t = Title::makeTitle( $s->wl_namespace, $s->wl_title );
-                       if( is_null( $t ) ) {
-                               $wgOut->addHTML( '<!-- bad title "' . htmlspecialchars( $s->wl_title ) . '" in namespace ' . IntVal( $s->wl_namespace ) . " -->\n" );
-                       } else {
-                               $t = $t->getPrefixedText();
-                               $wgOut->addHTML( '<li><input type="checkbox" name="id[]" value="' . htmlspecialchars($t) . '" />' .
-                                       $sk->makeLink( $t, $t ) .
-                                       "</li>\n" );
+                       $list[$s->wl_namespace][] = $s->wl_title;
+               }
+               
+               // TODO: Display a t TOC
+               foreach($list as $ns => $titles) {
+                       if ($ns != NS_MAIN) 
+                               $wgOut->addHTML( '<h2>' . $wgContLang->getFormattedNsText( $ns ) . '</h2>' );
+                       $wgOut->addHTML( '<ul>' );
+                       foreach($titles as $title) {
+                               $t = Title::makeTitle( $ns, $title );
+                               if( is_null( $t ) ) {
+                                       $wgOut->addHTML(
+                                               '<!-- bad title "' .
+                                               htmlspecialchars( $s->wl_title ) . '" in namespace ' . $s->wl_namespace . " -->\n"
+                                       );
+                               } else {
+                                       $t = $t->getPrefixedText();
+                                       $wgOut->addHTML(
+                                               '<li><input type="checkbox" name="id[]" value="' . htmlspecialchars($t) . '" />' .
+                                               $sk->makeLink( $t, $t ) .
+                                               "</li>\n"
+                                       );
+                               }
                        }
+                       $wgOut->addHTML( '</ul>' );
                }
-               $wgOut->addHTML( "</ul>\n" .
+               $wgOut->addHTML(
                        "<input type='submit' name='remove' value=\"" .
                        htmlspecialchars( wfMsg( "removechecked" ) ) . "\" />\n" .
-                       "</form>\n" );
+                       "</form>\n"
+               );
 
                return;
        }