X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FWebInstallerOptions.php;h=d798ea1e1ab803a5fc45fce2f429739982915dec;hb=942728ab20e01bba200031b01eb606ee59279bd2;hp=07378ab32e3cac965dabd26c91d56e5df9bece63;hpb=1b13888ed6bd09731f10045650714a3392bb55df;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/WebInstallerOptions.php b/includes/installer/WebInstallerOptions.php index 07378ab32e..d798ea1e1a 100644 --- a/includes/installer/WebInstallerOptions.php +++ b/includes/installer/WebInstallerOptions.php @@ -25,6 +25,8 @@ class WebInstallerOptions extends WebInstallerPage { * @return string|null */ public function execute() { + global $wgLang; + if ( $this->getVar( '_SkipOptional' ) == 'skip' ) { $this->submitSkins(); return 'skip'; @@ -145,20 +147,93 @@ class WebInstallerOptions extends WebInstallerPage { $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 :) @@ -259,7 +334,7 @@ class WebInstallerOptions extends WebInstallerPage { foreach ( $screenshots as $shot ) { $links[] = Html::element( 'a', - [ 'href' => $shot ], + [ 'href' => $shot, 'target' => '_blank' ], $wgLang->formatNum( $counter++ ) ); } @@ -269,7 +344,7 @@ class WebInstallerOptions extends WebInstallerPage { } 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();