r9549 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r9548‎ | r9549 | r9550 >
Date:15:00, 21 June 2005
Author:avar
Status:old
Tags:
Comment:
* Displaying namespace subheadings on Special:Watchlist/edit
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialWatchlist.php
@@ -124,8 +124,7 @@
125125
126126 $wgOut->addHTML( '<form action=\'' .
127127 $specialTitle->escapeLocalUrl( 'action=submit' ) .
128 - "' method='post'>\n" .
129 - "<ul>\n" );
 128+ "' method='post'>\n" );
130129
131130 # Patch A2
132131 # The following was proposed by KTurner 07.11.2004 to T.Gries
@@ -134,21 +133,40 @@
135134
136135 $res = $dbr->query( $sql, $fname );
137136 $sk = $wgUser->getSkin();
 137+
 138+ $list = array();
138139 while( $s = $dbr->fetchObject( $res ) ) {
139 - $t = Title::makeTitle( $s->wl_namespace, $s->wl_title );
140 - if( is_null( $t ) ) {
141 - $wgOut->addHTML( '<!-- bad title "' . htmlspecialchars( $s->wl_title ) . '" in namespace ' . IntVal( $s->wl_namespace ) . " -->\n" );
142 - } else {
143 - $t = $t->getPrefixedText();
144 - $wgOut->addHTML( '<li><input type="checkbox" name="id[]" value="' . htmlspecialchars($t) . '" />' .
145 - $sk->makeLink( $t, $t ) .
146 - "</li>\n" );
 140+ $list[$s->wl_namespace][] = $s->wl_title;
 141+ }
 142+
 143+ // TODO: Display a t TOC
 144+ foreach($list as $ns => $titles) {
 145+ if ($ns != NS_MAIN)
 146+ $wgOut->addHTML( '<h2>' . $wgContLang->getFormattedNsText( $ns ) . '</h2>' );
 147+ $wgOut->addHTML( '<ul>' );
 148+ foreach($titles as $title) {
 149+ $t = Title::makeTitle( $ns, $title );
 150+ if( is_null( $t ) ) {
 151+ $wgOut->addHTML(
 152+ '<!-- bad title "' .
 153+ htmlspecialchars( $s->wl_title ) . '" in namespace ' . $s->wl_namespace . " -->\n"
 154+ );
 155+ } else {
 156+ $t = $t->getPrefixedText();
 157+ $wgOut->addHTML(
 158+ '<li><input type="checkbox" name="id[]" value="' . htmlspecialchars($t) . '" />' .
 159+ $sk->makeLink( $t, $t ) .
 160+ "</li>\n"
 161+ );
 162+ }
147163 }
 164+ $wgOut->addHTML( '</ul>' );
148165 }
149 - $wgOut->addHTML( "</ul>\n" .
 166+ $wgOut->addHTML(
150167 "<input type='submit' name='remove' value=\"" .
151168 htmlspecialchars( wfMsg( "removechecked" ) ) . "\" />\n" .
152 - "</form>\n" );
 169+ "</form>\n"
 170+ );
153171
154172 return;
155173 }
Index: trunk/phase3/RELEASE-NOTES
@@ -312,6 +312,7 @@
313313 * (bug 2467) Added a Turkish language file
314314 * Fixed a bug in Special:Contributions that caused the namespace selection to
315315 be forgotten between submits
 316+* Special:Watchlist/edit now has namespace subheadings
316317
317318 === Caveats ===
318319

Status & tagging log