* (bug 11649) Show input form when Special:Whatlinkshere has no parameters
authorRaimond Spekking <raymond@users.mediawiki.org>
Thu, 18 Oct 2007 12:33:57 +0000 (12:33 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Thu, 18 Oct 2007 12:33:57 +0000 (12:33 +0000)
* Make Special:Whatlinkshere visible to Special:SpecialPages
* Move 2 messages in language (maintenance) files to a more generic place as they are no longer used by Special:Whatlinkshere but by other special pages furthermore
* Kill whitespaces

RELEASE-NOTES
includes/SpecialPage.php
includes/SpecialWhatlinkshere.php
languages/messages/MessagesDe.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index ed90980..bc49cb7 100644 (file)
@@ -39,7 +39,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   against the previous revision, whether currently deleted or live.
 * Added accesskey and tooltip for the "Go" button, and tooltip for the "Search"
   button.
-
+* (bug 11649) Show input form when Special:Whatlinkshere has no parameters
 
 === Bug fixes in 1.12 ===
 
index 10f334e..852b0b8 100644 (file)
@@ -123,7 +123,7 @@ class SpecialPage
                'Specialpages'              => array( 'UnlistedSpecialPage', 'Specialpages' ),
                'Contributions'             => array( 'SpecialPage', 'Contributions' ),
                'Emailuser'                 => array( 'UnlistedSpecialPage', 'Emailuser' ),
-               'Whatlinkshere'             => array( 'UnlistedSpecialPage', 'Whatlinkshere' ),
+               'Whatlinkshere'             => array( 'SpecialPage', 'Whatlinkshere' ),
                'Recentchangeslinked'       => array( 'UnlistedSpecialPage', 'Recentchangeslinked' ),
                'Movepage'                  => array( 'UnlistedSpecialPage', 'Movepage' ),
                'Blockme'                   => array( 'UnlistedSpecialPage', 'Blockme' ),
index d944f6b..8f2750d 100644 (file)
@@ -44,19 +44,19 @@ class WhatLinksHerePage {
 
                $targetString = isset($this->par) ? $this->par : $this->request->getVal( 'target' );
 
-               if (is_null($targetString)) {
-                       $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
+               if ( is_null( $targetString ) ) {
+                       $wgOut->addHTML( $this->whatlinkshereForm() );
                        return;
                }
 
                $this->target = Title::newFromURL( $targetString );
                if( !$this->target ) {
-                       $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
+                       $wgOut->addHTML( $this->whatlinkshereForm() );
                        return;
                }
                $this->selfTitle = Title::makeTitleSafe( NS_SPECIAL,
                        'Whatlinkshere/' . $this->target->getPrefixedDBkey() );
-                       
+
                $wgOut->setPageTitle( wfMsg( 'whatlinkshere-title', $this->target->getPrefixedText() ) );
                $wgOut->setSubtitle( wfMsg( 'linklistsub' ) );
 
@@ -113,34 +113,32 @@ class WhatLinksHerePage {
 
                // Read an extra row as an at-end check
                $queryLimit = $limit + 1;
-               
+
                // enforce join order, sometimes namespace selector may 
                // trigger filesorts which are far less efficient than scanning many entries
                $options[] = 'STRAIGHT_JOIN';
-               
+
                $options['LIMIT'] = $queryLimit;
                $fields = array( 'page_id', 'page_namespace', 'page_title', 'page_is_redirect' );
 
                $options['ORDER BY'] = 'pl_from';
                $plRes = $dbr->select( array( 'pagelinks', 'page' ), $fields,
                        $plConds, $fname, $options );
-                       
+
                $options['ORDER BY'] = 'tl_from';
                $tlRes = $dbr->select( array( 'templatelinks', 'page' ), $fields,
                        $tlConds, $fname, $options );
-               
+
                if ( !$dbr->numRows( $plRes ) && !$dbr->numRows( $tlRes ) ) {
-                       if ( 0 == $level && !isset( $this->namespace ) ) {
-                               // really no links to here
-                               $wgOut->addWikiText( wfMsg( 'nolinkshere', $this->target->getPrefixedText() ) );
-                       } elseif ( 0 == $level && isset( $this->namespace ) ) {
-                               // no links from requested namespace to here
+                       if ( 0 == $level ) {
                                $options = array(); // reinitialize for a further namespace search
+                               // really no links to here
                                $options['namespace'] = $this->namespace;
                                $options['target'] = $this->target->getPrefixedText();
                                list( $options['limit'], $options['offset']) = wfCheckLimits();
                                $wgOut->addHTML( $this->whatlinkshereForm( $options ) );
-                               $wgOut->addWikiText( wfMsg( 'nolinkshere-ns', $this->target->getPrefixedText() ) );
+                               $errMsg = isset( $this->namespace ) ? 'nolinkshere-ns' : 'nolinkshere';
+                               $wgOut->addWikiText( wfMsg( $errMsg, $this->target->getPrefixedText() ) );
                        }
                        return;
                }
@@ -295,24 +293,26 @@ class WhatLinksHerePage {
                return $this->makeSelfLink( $fmtLimit, $query );
        }
 
-       function whatlinkshereForm( $options ) {
+       function whatlinkshereForm( $options = array( 'target' => '', 'namespace' => '' ) ) {
                global $wgScript, $wgTitle;
 
                $options['title'] = $wgTitle->getPrefixedText();
 
                $f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => "$wgScript" ) ) .
-                       '<fieldset>' .
-                       Xml::element( 'legend', array(), wfMsg( 'whatlinkshere' ) );
+                       Xml::openElement( 'fieldset' ) .
+                       Xml::element( 'legend', array(), wfMsg( 'whatlinkshere' ) ) .
+                       Xml::inputLabel( wfMsg( 'whatlinkshere-page' ), 'target', 'mw-whatlinkshere-target', 40, $options['target'] ) . ' ';
 
                foreach ( $options as $name => $value ) {
-                       if( $name === 'namespace') continue;
+                       if( $name === 'namespace' || $name === 'target' )
+                               continue;
                        $f .= "\t" . Xml::hidden( $name, $value ). "\n";
                }
 
                $f .= Xml::label( wfMsg( 'namespace' ), 'namespace' ) . ' ' .
                        Xml::namespaceSelector( $options['namespace'], '' ) .
                        Xml::submitButton( wfMsg( 'allpagessubmit' ) ) .
-                       '</fieldset>' .
+                       Xml::closeElement( 'fieldset' ) .
                        Xml::closeElement( 'form' ) . "\n";
 
                return $f;
@@ -324,5 +324,3 @@ class WhatLinksHerePage {
        }
 
 }
-
-
index ae501a2..2d665f9 100644 (file)
@@ -1307,6 +1307,8 @@ auf die bereits die erste Weiterleitung zeigen sollte.',
 'movethispage'                    => 'Seite verschieben',
 'unusedimagestext'                => '<p>Bitte beachte, dass andere Webseiten dieses Bild mit einer direkten URL verlinken können. Diese wird nicht als Verwendung erkannt, so dass das Bild hier aufgeführt wird.</p>',
 'unusedcategoriestext'            => 'Diese Spezialseite zeigt alle Kategorien, die selber keiner Kategorie zugewiesen wurden.',
+'notargettitle'                   => 'Keine Seite angegeben',
+'notargettext'                    => 'Du hast nicht angegeben, auf welche Seite diese Funktion angewendet werden soll.',
 
 # Book sources
 'booksources'               => 'ISBN-Suche',
@@ -1596,11 +1598,10 @@ $1',
 'sp-newimages-showfrom' => 'Zeige neue Dateien ab $1',
 
 # What links here
-'whatlinkshere'         => 'Links auf diese Seite',
+'whatlinkshere'         => 'Linkliste',
 'whatlinkshere-title'   => 'Seiten, die auf „$1“ verlinken',
 'whatlinkshere-summary' => 'Diese Spezialseite listet alle internen Links auf eine bestimmte Seite auf. Die möglichen Zusätze „(Vorlageneinbindung)“ und „(Weiterleitungsseite)“ zeigen jeweils an, dass die Seite nicht durch einen normalen Wikilink eingebunden ist. ',
-'notargettitle'         => 'Keine Seite angegeben',
-'notargettext'          => 'Du hast nicht angegeben, auf welche Seite diese Funktion angewendet werden soll.',
+'whatlinkshere-page'    => 'Seite:',
 'linklistsub'           => '(Linkliste)',
 'linkshere'             => "Die folgenden Seiten verlinken auf '''„[[:$1]]“''':",
 'nolinkshere'           => "Keine Seite verlinkt auf '''„[[:$1]]“'''.",
index 4dd3ae2..013bf9c 100644 (file)
@@ -1674,6 +1674,8 @@ The [http://meta.wikimedia.org/wiki/Help:Job_queue job queue] length is '''$7'''
 a direct URL, and so may still be listed here despite being
 in active use.</p>',
 'unusedcategoriestext'            => 'The following category pages exist although no other article or category make use of them.',
+'notargettitle'                   => 'No target',
+'notargettext'                    => 'You have not specified a target page or user to perform this function on.',
 
 # Book sources
 'booksources'               => 'Book sources',
@@ -1994,11 +1996,10 @@ Consult the [[Special:Log/delete|deletion log]] for a record of recent deletions
 
 # What links here
 'whatlinkshere'         => 'What links here',
-'whatlinkshere-title' => 'Pages that link to $1',
+'whatlinkshere-title'   => 'Pages that link to $1',
 'whatlinkshere-summary' => '', # only translate this message to other languages if you have to change it
 'whatlinkshere-barrow'  => '&lt;', # only translate this message to other languages if you have to change it
-'notargettitle'         => 'No target',
-'notargettext'          => 'You have not specified a target page or user to perform this function on.',
+'whatlinkshere-page'    => 'Page:',
 'linklistsub'           => '(List of links)',
 'linkshere'             => "The following pages link to '''[[:$1]]''':",
 'nolinkshere'           => "No pages link to '''[[:$1]]'''.",
index 6cc4b12..cdf56d7 100644 (file)
@@ -1058,6 +1058,8 @@ $wgMessageStructure = array(
                'movethispage',
                'unusedimagestext',
                'unusedcategoriestext',
+               'notargettitle',
+               'notargettext',
        ),
        'booksources' => array(
                'booksources',
@@ -1320,9 +1322,8 @@ $wgMessageStructure = array(
                'whatlinkshere',
                'whatlinkshere-title',
                'whatlinkshere-summary',
+               'whatlinkshere-page',
                'whatlinkshere-barrow',
-               'notargettitle',
-               'notargettext',
                'linklistsub',
                'linkshere',
                'nolinkshere',