bugs and ensure better reading experience for different variants.
=== Other changes in 1.25 ===
+* (T45591) Links to MediaWiki.org translatable help were added to indicators,
+ mostly in special pages. Local custom target titles can be placed in the
+ relevant '(namespace-X|action name|special page name)-helppage' system
+ message. Extensions can use the addHelpLink() function to do the same.
* The skin autodiscovery mechanism, deprecated in MediaWiki 1.23, has been
removed. See https://www.mediawiki.org/wiki/Manual:Skin_autodiscovery for
migration guide for creators and users of custom skins that relied on it.
/**
* Adds help link with an icon via page indicators.
- * @param string $to
- * @param bool $overrideBaseUrl
+ * Link target can be overridden by a local message containing a wikilink:
+ * the message key is: lowercase action or special page name + '-helppage'.
+ * @param string $to Target MediaWiki.org page title or encoded URL.
+ * @param bool $overrideBaseUrl Whether $url is a full URL, to avoid MW.o.
* @since 1.25
*/
public function addHelpLink( $to, $overrideBaseUrl = false ) {
$toUrlencoded = wfUrlencode( str_replace( ' ', '_', $to ) );
$helpUrl = "//www.mediawiki.org/wiki/Special:MyLanguage/$toUrlencoded";
}
+
$link = Html::rawElement(
'a',
array(
return $this->msg( strtolower( $this->getName() ) )->escaped();
}
+ /**
+ * Adds help link with an icon via page indicators.
+ * Link target can be overridden by a local message containing a wikilink:
+ * the message key is: lowercase action name + '-helppage'.
+ * @param string $to Target MediaWiki.org page title or encoded URL.
+ * @param bool $overrideBaseUrl Whether $url is a full URL, to avoid MW.o.
+ * @since 1.25
+ */
+ public function addHelpLink( $to, $overrideBaseUrl = false ) {
+ $msg = wfMessage( $wgContLang->lc( $this->getActionName() ) . '-helppage' );
+
+ if ( !$msg->isDisabled() ) {
+ $helpUrl = Skin::makeUrl( $msg->plain() );
+ $this->getOutput()->addHelpLink( $helpUrl, true );
+ } else {
+ $this->getOutput()->addHelpLink( $to, $overrideBaseUrl );
+ }
+ }
+
/**
* The main action entry point. Do all output for display and send it to the context
* output. Do not use globals $wgOut, $wgRequest, etc, in implementations; use
'mediawiki.ui.checkbox',
) );
}
- $out->addHelpLink( 'Help:Sysop deleting and undeleting' );
+ $this->addHelpLink( 'Help:Sysop deleting and undeleting' );
$this->page->delete();
}
}
'</div>';
}
+ /**
+ * Adds help link with an icon via page indicators.
+ * Link target can be overridden by a local message containing a wikilink:
+ * the message key is: 'namespace-' + namespace number + '-helppage'.
+ * @param string $to Target MediaWiki.org page title or encoded URL.
+ * @param bool $overrideBaseUrl Whether $url is a full URL, to avoid MW.o.
+ * @since 1.25
+ */
+ public function addHelpLink( $to, $overrideBaseUrl = false ) {
+ $msg = wfMessage(
+ 'namespace-' . $this->getTitle()->getNamespace() . '-helppage'
+ );
+
+ if ( !$msg->isDisabled() ) {
+ $helpUrl = Skin::makeUrl( $msg->plain() );
+ $this->getOutput()->addHelpLink( $helpUrl, true );
+ } else {
+ $this->getOutput()->addHelpLink( $to, $overrideBaseUrl );
+ }
+ }
+
/**
* Handle action=render
*/
);
$out = $this->getContext()->getOutput();
$out->addHTML( $viewer->getHTML() );
- $out->addHelpLink( 'Help:Categories' );
+ $this->addHelpLink( 'Help:Categories' );
}
}
}
}
+ /**
+ * Adds help link with an icon via page indicators.
+ * Link target can be overridden by a local message containing a wikilink:
+ * the message key is: lowercase special page name + '-helppage'.
+ * @param string $to Target MediaWiki.org page title or encoded URL.
+ * @param bool $overrideBaseUrl Whether $url is a full URL, to avoid MW.o.
+ * @since 1.25
+ */
+ public function addHelpLink( $to, $overrideBaseUrl = false ) {
+ global $wgContLang;
+ $msg = $this->msg( $wgContLang->lc( $this->getName() ) . '-helppage' );
+
+ if ( !$msg->isDisabled() ) {
+ $helpUrl = Skin::makeUrl( $msg->plain() );
+ $this->getOutput()->addHelpLink( $helpUrl, true );
+ } else {
+ $this->getOutput()->addHelpLink( $to, $overrideBaseUrl );
+ }
+ }
+
/**
* Get the group that the special page belongs in on Special:SpecialPage
* Use this method, instead of getGroupName to allow customization
$this->outputHeader( 'allmessagestext' );
$out->addModuleStyles( 'mediawiki.special' );
- $out->addHelpLink( 'Help:System message' );
+ $this->addHelpLink( 'Help:System message' );
$this->table = new AllMessagesTablePager(
$this,
$msg = $this->alreadyBlocked ? 'ipb-change-block' : 'ipbsubmit';
$form->setSubmitTextMsg( $msg );
- $this->getOutput()->addHelpLink( 'Help:Blocking users' );
+ $this->addHelpLink( 'Help:Blocking users' );
# Don't need to do anything if the form has been posted
if ( !$this->getRequest()->wasPosted() && $this->preErrors ) {
$this->mAddedRedirectParams['diff'] = $parts[1];
} else {
// Wrong number of parameters, bail out
- $this->getOutput()->addHelpLink( 'Help:Diff' );
+ $this->addHelpLink( 'Help:Diff' );
throw new ErrorPageError( 'nopagetitle', 'nopagetext' );
}
$this->targetObj->getPrefixedText()
) );
- $out->addHelpLink( 'Help:Tags' );
+ $this->addHelpLink( 'Help:Tags' );
$out->addHTML( "<ul>" );
$numRevisions = 0;
'</form>'
);
- $out->addHelpLink( 'Help:Merge history' );
+ $this->addHelpLink( 'Help:Merge history' );
}
private function showHistory() {
$out = $this->getOutput();
$out->setPageTitle( $this->msg( 'move-page', $this->oldTitle->getPrefixedText() ) );
$out->addModules( 'mediawiki.special.movePage' );
- $out->addHelpLink( 'Help:Moving a page' );
+ $this->addHelpLink( 'Help:Moving a page' );
$newTitle = $this->newTitle;
$this->outputHeader();
$out = $this->getOutput();
- $out->addHelpLink( 'Help:New images' );
+ $this->addHelpLink( 'Help:New images' );
$pager = new NewFilesPager( $this->getContext(), $par );
$this->showNavigation = !$this->including(); // Maybe changed in setup
$this->setup( $par );
- $out->addHelpLink( 'Help:New pages' );
+ $this->addHelpLink( 'Help:New pages' );
if ( !$this->including() ) {
// Settings
);
}
- $out->addHelpLink( 'Help:Preferences' );
+ $this->addHelpLink( 'Help:Preferences' );
$htmlForm = Preferences::getFormObject( $this->getUser(), $this->getContext() );
$htmlForm->setSubmitCallback( array( 'Preferences', 'tryUISubmit' ) );
}
protected function getFormFields() {
- $this->getOutput()->addHelpLink( 'Help:RandomInCategory' );
+ $this->addHelpLink( 'Help:RandomInCategory' );
$form = array(
'category' => array(
$out->wrapWikiMsg( "<strong>$1</strong>", array( $this->typeLabels['selected'],
$this->getLanguage()->formatNum( count( $this->ids ) ), $this->targetObj->getPrefixedText() ) );
- $out->addHelpLink( 'Help:RevisionDelete' );
+ $this->addHelpLink( 'Help:RevisionDelete' );
$out->addHTML( "<ul>" );
$numRevisions = 0;
return;
}
- $out->addHelpLink( 'Help:Special pages' );
+ $this->addHelpLink( 'Help:Special pages' );
$this->outputPageList( $groups );
}
return;
}
- $out->addHelpLink( 'Help:Undelete' );
+ $this->addHelpLink( 'Help:Undelete' );
if ( $this->mAllowed ) {
$out->setPageTitle( $this->msg( 'undeletepage' ) );
} else {
throw new ErrorPageError( 'uploaddisabled', 'uploaddisabledtext' );
}
- $this->getOutput()->addHelpLink( 'Help:Managing files' );
+ $this->addHelpLink( 'Help:Managing files' );
# Check permissions
$user = $this->getUser();
$out = $this->getOutput();
$out->addModuleStyles( 'mediawiki.special' );
- $out->addHelpLink( 'Help:Assigning permissions' );
+ $this->addHelpLink( 'Help:Assigning permissions' );
// show the general form
if ( count( $available['add'] ) || count( $available['remove'] ) ) {