'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' ),
$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' ) );
// 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;
}
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;
}
}
-
-
'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',
'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]]“'''.",
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',
# 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' => '<', # 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]]'''.",