Index: branches/REL1_18/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 | } |
— | — | @@ -86,6 +88,8 @@ |
87 | 89 | if( $form->show() ){ |
88 | 90 | $out->addHTML( $this->successMessage ); |
89 | 91 | $out->returnToMain(); |
| 92 | + } elseif ( $this->toc !== false ) { |
| 93 | + $out->prependHTML( $this->toc ); |
90 | 94 | } |
91 | 95 | break; |
92 | 96 | } |
— | — | @@ -391,6 +395,7 @@ |
392 | 396 | global $wgContLang; |
393 | 397 | |
394 | 398 | $fields = array(); |
| 399 | + $count = 0; |
395 | 400 | |
396 | 401 | $haveInvalidNamespaces = false; |
397 | 402 | foreach( $this->getWatchlistInfo() as $namespace => $pages ){ |
— | — | @@ -398,10 +403,6 @@ |
399 | 404 | $haveInvalidNamespaces = true; |
400 | 405 | continue; |
401 | 406 | } |
402 | | - |
403 | | - $namespace == NS_MAIN |
404 | | - ? wfMsgHtml( 'blanknamespace' ) |
405 | | - : htmlspecialchars( $wgContLang->getFormattedNsText( $namespace ) ); |
406 | 407 | |
407 | 408 | $fields['TitlesNs'.$namespace] = array( |
408 | 409 | 'class' => 'EditWatchlistCheckboxSeriesField', |
— | — | @@ -413,6 +414,7 @@ |
414 | 415 | $title = Title::makeTitleSafe( $namespace, $dbkey ); |
415 | 416 | $text = $this->buildRemoveLine( $title, $redirect ); |
416 | 417 | $fields['TitlesNs'.$namespace]['options'][$text] = $title->getEscapedText(); |
| 418 | + $count++; |
417 | 419 | } |
418 | 420 | } |
419 | 421 | if ( $haveInvalidNamespaces ) { |
— | — | @@ -420,7 +422,22 @@ |
421 | 423 | $this->getContext()->getUser()->cleanupWatchlist(); |
422 | 424 | } |
423 | 425 | |
424 | | - $form = new EditWatchlistNormalHTMLForm( $fields ); |
| 426 | + if ( count( $fields ) > 1 && $count > 30 ) { |
| 427 | + $this->toc = Linker::tocIndent(); |
| 428 | + $tocLength = 0; |
| 429 | + foreach( $fields as $key => $data ) { |
| 430 | + $ns = substr( $data['section'], 2 ); |
| 431 | + $nsText = $ns == NS_MAIN |
| 432 | + ? wfMsgHtml( 'blanknamespace' ) |
| 433 | + : htmlspecialchars( $wgContLang->getFormattedNsText( $ns ) ); |
| 434 | + $this->toc .= Linker::tocLine( "mw-htmlform-{$data['section']}", $nsText, ++$tocLength, 1 ) . Linker::tocLineEnd(); |
| 435 | + } |
| 436 | + $this->toc = Linker::tocList( $this->toc ); |
| 437 | + } else { |
| 438 | + $this->toc = false; |
| 439 | + } |
| 440 | + |
| 441 | + $form = new EditWatchlistNormalHTMLForm( $fields, $this->getContext() ); |
425 | 442 | $form->setTitle( $this->getTitle() ); |
426 | 443 | $form->setSubmitText( wfMessage( 'watchlistedit-normal-submit' )->text() ); |
427 | 444 | $form->setWrapperLegend( wfMessage( 'watchlistedit-normal-legend' )->text() ); |
Property changes on: branches/REL1_18/phase3/includes/specials |
___________________________________________________________________ |
Modified: svn:mergeinfo |
428 | 445 | Merged /trunk/phase3/includes/specials:r102334-102335 |
Property changes on: branches/REL1_18/phase3/includes |
___________________________________________________________________ |
Modified: svn:mergeinfo |
429 | 446 | Merged /trunk/phase3/includes:r102334-102335 |
Property changes on: branches/REL1_18/phase3 |
___________________________________________________________________ |
Modified: svn:mergeinfo |
430 | 447 | Merged /trunk/phase3:r102334-102335 |