From: Ilmari Karonen Date: Sat, 13 Dec 2008 22:45:18 +0000 (+0000) Subject: (bug 16635) Add TOC to Special:Watchlist/edit X-Git-Tag: 1.31.0-rc.0~43985 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=ccbe939dffad2fcb0c7a813b9610671899612bcf;p=lhc%2Fweb%2Fwiklou.git (bug 16635) Add TOC to Special:Watchlist/edit --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 37a98d1b1f..866e81f106 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -227,6 +227,8 @@ The following extensions are migrated into MediaWiki 1.14: as 1.3 (gfdl1_3). * (bug 16293) PD URL was changed to the CreativeCommons site on PD (which auto-detects your language) instead of Wikipedia. +* (bug 16635) The "view and edit watchlist" page (Special:Watchlist/edit) now + includes a table of contents === Bug fixes in 1.14 === diff --git a/includes/WatchlistEditor.php b/includes/WatchlistEditor.php index 82c524c65e..e49851bdaf 100644 --- a/includes/WatchlistEditor.php +++ b/includes/WatchlistEditor.php @@ -344,21 +344,47 @@ class WatchlistEditor { $form .= Xml::hidden( 'token', $wgUser->editToken( 'watchlistedit' ) ); $form .= "
\n" . wfMsgHtml( 'watchlistedit-normal-legend' ) . ""; $form .= wfMsgExt( 'watchlistedit-normal-explain', 'parse' ); - foreach( $this->getWatchlistInfo( $user ) as $namespace => $pages ) { - $form .= "

" . $this->getNamespaceHeading( $namespace ) . "

\n"; - $form .= "\n"; - } + $form .= $this->buildRemoveList( $user, $wgUser->getSkin() ); $form .= '

' . Xml::submitButton( wfMsg( 'watchlistedit-normal-submit' ) ) . '

'; $form .= '
'; $output->addHTML( $form ); } } + /** + * Build the part of the standard watchlist editing form with the actual + * title selection checkboxes and stuff. Also generates a table of + * contents if there's more than one heading. + * + * @param $user User + * @param $skin Skin (really, Linker) + */ + private function buildRemoveList( $user, $skin ) { + $list = ""; + $toc = $skin->tocIndent(); + $tocLength = 0; + foreach( $this->getWatchlistInfo( $user ) as $namespace => $pages ) { + $tocLength++; + $heading = htmlspecialchars( $this->getNamespaceHeading( $namespace ) ); + $anchor = "editwatchlist-ns" . $namespace; + + $list .= $skin->makeHeadLine( 2, ">", $anchor, $heading, "" ); + $toc .= $skin->tocLine( $anchor, $heading, $tocLength, 1 ) . $skin->tocLineEnd(); + + $list .= "\n"; + } + // ISSUE: omit the TOC if the total number of titles is low? + if( $tocLength > 1 ) { + $list = $skin->tocList( $toc ) . $list; + } + return $list; + } + /** * Get the correct "heading" for a namespace *