(bug 16762) Special:Movepage now shows a list of subpages when possible
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Wed, 18 Feb 2009 21:46:38 +0000 (21:46 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Wed, 18 Feb 2009 21:46:38 +0000 (21:46 +0000)
CREDITS
RELEASE-NOTES
includes/specials/SpecialMovepage.php

diff --git a/CREDITS b/CREDITS
index 38d1730..119f243 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -68,6 +68,7 @@ following names for their contribution to the product.
 * Juliano F. Ravasi
 * Lucas Garczewski
 * Louperivois
+* Manuel Menal
 * Marcin Cieślak
 * Marooned
 * Max Semenik
index 0b5aaab..846fcf5 100644 (file)
@@ -111,6 +111,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   Mediawiki:Shared-repo-name-REPONAME, where REPONAME is the name in 
   $wgForeignFileRepos
 * Special:ListUsers: Sort list of usergroups by alphabet
+* (bug 16762) Special:Movepage now shows a list of subpages when possible
 
 === Bug fixes in 1.15 ===
 * (bug 16968) Special:Upload no longer throws useless warnings.
index 0375edf..d7a8eaa 100644 (file)
@@ -284,6 +284,7 @@ class MovePageForm {
                );
 
                $this->showLogFragment( $this->oldTitle, $wgOut );
+               $this->showSubpages( $this->oldTitle, $wgOut );
 
        }
 
@@ -497,4 +498,32 @@ class MovePageForm {
                LogEventsList::showLogExtract( $out, 'move', $title->getPrefixedText() );
        }
 
+       function showSubpages( $title, $out ) {
+               global $wgUser;
+
+               if( !MWNamespace::hasSubpages( $title->getNamespace() ) )
+                       return;
+
+               $out->wrapWikiMsg( '== $1 ==', 'movesubpage' );
+               $subpages = $title->getSubpages();
+
+               # No subpages.
+               if ( !( $subpages instanceof TitleArray ) || $subpages->count() == 0 ) {
+                       $out->addWikiMsg( 'movenosubpage' );
+                       return;
+               }
+
+               $skin = $wgUser->getSkin();
+               $out->addHTML( "<ul>\n" );
+
+               foreach( $subpages as $subpage ) {
+                       $link = $skin->link( $subpage );
+                       if ( $subpage->isRedirect() )
+                               $link = '<div class="allpagesredirect">' . $link . '</div>' ;
+
+                       $out->addHTML( "<li>$link</li>\n" );
+               }
+               $out->addHTML( "</ul>\n" );
+       }
 }
+