r102546 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102545‎ | r102546 | r102547 >
Date:17:40, 9 November 2011
Author:reedy
Status:ok
Tags:
Comment:
REL1_18 MFT r102334, r102335
Modified paths:
  • /branches/REL1_18/phase3 (modified) (history)
  • /branches/REL1_18/phase3/includes (modified) (history)
  • /branches/REL1_18/phase3/includes/specials (modified) (history)
  • /branches/REL1_18/phase3/includes/specials/SpecialEditWatchlist.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/includes/specials/SpecialEditWatchlist.php
@@ -18,6 +18,8 @@
1919
2020 protected $successMessage;
2121
 22+ protected $toc;
 23+
2224 public function __construct(){
2325 parent::__construct( 'EditWatchlist' );
2426 }
@@ -86,6 +88,8 @@
8789 if( $form->show() ){
8890 $out->addHTML( $this->successMessage );
8991 $out->returnToMain();
 92+ } elseif ( $this->toc !== false ) {
 93+ $out->prependHTML( $this->toc );
9094 }
9195 break;
9296 }
@@ -391,6 +395,7 @@
392396 global $wgContLang;
393397
394398 $fields = array();
 399+ $count = 0;
395400
396401 $haveInvalidNamespaces = false;
397402 foreach( $this->getWatchlistInfo() as $namespace => $pages ){
@@ -398,10 +403,6 @@
399404 $haveInvalidNamespaces = true;
400405 continue;
401406 }
402 -
403 - $namespace == NS_MAIN
404 - ? wfMsgHtml( 'blanknamespace' )
405 - : htmlspecialchars( $wgContLang->getFormattedNsText( $namespace ) );
406407
407408 $fields['TitlesNs'.$namespace] = array(
408409 'class' => 'EditWatchlistCheckboxSeriesField',
@@ -413,6 +414,7 @@
414415 $title = Title::makeTitleSafe( $namespace, $dbkey );
415416 $text = $this->buildRemoveLine( $title, $redirect );
416417 $fields['TitlesNs'.$namespace]['options'][$text] = $title->getEscapedText();
 418+ $count++;
417419 }
418420 }
419421 if ( $haveInvalidNamespaces ) {
@@ -420,7 +422,22 @@
421423 $this->getContext()->getUser()->cleanupWatchlist();
422424 }
423425
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() );
425442 $form->setTitle( $this->getTitle() );
426443 $form->setSubmitText( wfMessage( 'watchlistedit-normal-submit' )->text() );
427444 $form->setWrapperLegend( wfMessage( 'watchlistedit-normal-legend' )->text() );
Property changes on: branches/REL1_18/phase3/includes/specials
___________________________________________________________________
Modified: svn:mergeinfo
428445 Merged /trunk/phase3/includes/specials:r102334-102335
Property changes on: branches/REL1_18/phase3/includes
___________________________________________________________________
Modified: svn:mergeinfo
429446 Merged /trunk/phase3/includes:r102334-102335
Property changes on: branches/REL1_18/phase3
___________________________________________________________________
Modified: svn:mergeinfo
430447 Merged /trunk/phase3:r102334-102335

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102334(bug 31502) (follow-up r84718) Restore ToC to Special:EditWatchlist if there ...happy-melon22:11, 7 November 2011
r102335Follow-up r102334: odd that this minus sign (yes, copied from a diff) was act...happy-melon22:15, 7 November 2011

Status & tagging log