* @return string|null
*/
public function execute() {
+ global $wgLang;
+
if ( $this->getVar( '_SkipOptional' ) == 'skip' ) {
$this->submitSkins();
return 'skip';
$this->addHTML( $skinHtml );
$extensions = $this->parent->findExtensions();
+ $dependencyMap = [];
if ( $extensions ) {
$extHtml = $this->getFieldsetStart( 'config-extensions' );
+ $extByType = [];
+ $types = SpecialVersion::getExtensionTypes();
+ // Sort by type first
foreach ( $extensions as $ext => $info ) {
- $extHtml .= $this->parent->getCheckBox( [
- 'var' => "ext-$ext",
- 'rawtext' => $ext,
- ] );
+ if ( !isset( $info['type'] ) || !isset( $types[$info['type']] ) ) {
+ // We let extensions normally define custom types, but
+ // since we aren't loading extensions, we'll have to
+ // categorize them under other
+ $info['type'] = 'other';
+ }
+ $extByType[$info['type']][$ext] = $info;
+ }
+
+ foreach ( $types as $type => $message ) {
+ if ( !isset( $extByType[$type] ) ) {
+ continue;
+ }
+ $extHtml .= Html::element( 'h2', [], $message );
+ foreach ( $extByType[$type] as $ext => $info ) {
+ $urlText = '';
+ if ( isset( $info['url'] ) ) {
+ $urlText = ' ' . Html::element( 'a', [ 'href' => $info['url'] ], '(more information)' );
+ }
+ $attribs = [
+ 'data-name' => $ext,
+ 'class' => 'config-ext-input'
+ ];
+ $labelAttribs = [];
+ $fullDepList = [];
+ if ( isset( $info['requires']['extensions'] ) ) {
+ $dependencyMap[$ext]['extensions'] = $info['requires']['extensions'];
+ $labelAttribs['class'] = 'mw-ext-with-dependencies';
+ }
+ if ( isset( $info['requires']['skins'] ) ) {
+ $dependencyMap[$ext]['skins'] = $info['requires']['skins'];
+ $labelAttribs['class'] = 'mw-ext-with-dependencies';
+ }
+ if ( isset( $dependencyMap[$ext] ) ) {
+ $links = [];
+ // For each dependency, link to the checkbox for each
+ // extension/skin that is required
+ if ( isset( $dependencyMap[$ext]['extensions'] ) ) {
+ foreach ( $dependencyMap[$ext]['extensions'] as $name ) {
+ $links[] = Html::element(
+ 'a',
+ [ 'href' => "#config_ext-$name" ],
+ $name
+ );
+ }
+ }
+ if ( isset( $dependencyMap[$ext]['skins'] ) ) {
+ foreach ( $dependencyMap[$ext]['skins'] as $name ) {
+ $links[] = Html::element(
+ 'a',
+ [ 'href' => "#config_skin-$name" ],
+ $name
+ );
+ }
+ }
+
+ $text = wfMessage( 'config-extensions-requires' )
+ ->rawParams( $ext, $wgLang->commaList( $links ) )
+ ->escaped();
+ } else {
+ $text = $ext;
+ }
+ $extHtml .= $this->parent->getCheckBox( [
+ 'var' => "ext-$ext",
+ 'rawtext' => $text,
+ 'attribs' => $attribs,
+ 'labelAttribs' => $labelAttribs,
+ ] );
+ }
}
$extHtml .= $this->parent->getHelpBox( 'config-extensions-help' ) .
$this->getFieldsetEnd();
$this->addHTML( $extHtml );
+ // Push the dependency map to the client side
+ $this->addHTML( Html::inlineScript(
+ 'var extDependencyMap = ' . Xml::encodeJsVar( $dependencyMap )
+ ) );
}
// Having / in paths in Windows looks funny :)
foreach ( $screenshots as $shot ) {
$links[] = Html::element(
'a',
- [ 'href' => $shot ],
+ [ 'href' => $shot, 'target' => '_blank' ],
$wgLang->formatNum( $counter++ )
);
}
} else {
$link = Html::element(
'a',
- [ 'href' => $screenshots[0] ],
+ [ 'href' => $screenshots[0], 'target' => '_blank' ],
wfMessage( 'config-screenshot' )->text()
);
return wfMessage( 'config-skins-screenshot', $name )->rawParams( $link )->escaped();
return '<p>' .
Html::element( 'img', [ 'src' => $this->getVar( 'wgRightsIcon' ) ] ) .
- '  ' .
+ '\u{00A0}\u{00A0}' .
htmlspecialchars( $this->getVar( 'wgRightsText' ) ) .
"</p>\n" .
"<p style=\"text-align: center;\">" .