| Index: trunk/phase3/includes/specials/SpecialEditWatchlist.php |
| — | — | @@ -18,6 +18,8 @@ |
| 19 | 19 | |
| 20 | 20 | protected $successMessage; |
| 21 | 21 | |
| | 22 | + protected $toc; |
| | 23 | + |
| 22 | 24 | public function __construct(){ |
| 23 | 25 | parent::__construct( 'EditWatchlist' ); |
| 24 | 26 | } |
| — | — | @@ -90,6 +92,8 @@ |
| 91 | 93 | if( $form->show() ){ |
| 92 | 94 | $out->addHTML( $this->successMessage ); |
| 93 | 95 | $out->returnToMain(); |
| | 96 | + } elseif ( $this->toc !== false ) { |
| | 97 | + $out->prependHTML( $this->toc ); |
| 94 | 98 | } |
| 95 | 99 | break; |
| 96 | 100 | } |
| — | — | @@ -382,10 +386,6 @@ |
| 383 | 387 | $haveInvalidNamespaces = true; |
| 384 | 388 | continue; |
| 385 | 389 | } |
| 386 | | - |
| 387 | | - $namespace == NS_MAIN |
| 388 | | - ? wfMsgHtml( 'blanknamespace' ) |
| 389 | | - : htmlspecialchars( $wgContLang->getFormattedNsText( $namespace ) ); |
| 390 | 390 | |
| 391 | 391 | $fields['TitlesNs'.$namespace] = array( |
| 392 | 392 | 'class' => 'EditWatchlistCheckboxSeriesField', |
| — | — | @@ -397,6 +397,7 @@ |
| 398 | 398 | $title = Title::makeTitleSafe( $namespace, $dbkey ); |
| 399 | 399 | $text = $this->buildRemoveLine( $title ); |
| 400 | 400 | $fields['TitlesNs'.$namespace]['options'][$text] = $title->getEscapedText(); |
| | 401 | + $count++; |
| 401 | 402 | } |
| 402 | 403 | } |
| 403 | 404 | if ( $haveInvalidNamespaces ) { |
| — | — | @@ -404,6 +405,21 @@ |
| 405 | 406 | $this->getContext()->getUser()->cleanupWatchlist(); |
| 406 | 407 | } |
| 407 | 408 | |
| | 409 | + if ( count( $fields ) > 1 && $count > 30 ) { |
| | 410 | + $this->toc = Linker::tocIndent(); |
| | 411 | + $tocLength = 0; |
| | 412 | + foreach( $fields as $key => $data ) { |
| | 413 | + $ns = substr( $data['section'], 2 ); |
| | 414 | + $nsText = $ns == NS_MAIN |
| | 415 | + ? wfMsgHtml( 'blanknamespace' ) |
| | 416 | + : htmlspecialchars( $wgContLang->getFormattedNsText( $ns ) ); |
| | 417 | + -$this->toc .= Linker::tocLine( "mw-htmlform-{$data['section']}", $nsText, ++$tocLength, 1 ) . Linker::tocLineEnd(); |
| | 418 | + } |
| | 419 | + $this->toc = Linker::tocList( $this->toc ); |
| | 420 | + } else { |
| | 421 | + $this->toc = false; |
| | 422 | + } |
| | 423 | + |
| 408 | 424 | $form = new EditWatchlistNormalHTMLForm( $fields, $this->getContext() ); |
| 409 | 425 | $form->setTitle( $this->getTitle() ); |
| 410 | 426 | $form->setSubmitText( wfMessage( 'watchlistedit-normal-submit' )->text() ); |