43 $output->setPageTitle( $this->
msg(
'gadgets-title' ) );
44 $output->addWikiMsg(
'gadgets-pagetext' );
55 $langSuffix =
"/" .
$lang->getCode();
60 $editInterfaceMessage = $this->
getUser()->isAllowed(
'editinterface' )
65 foreach ( $gadgets as
$section => $entries ) {
67 $t = Title::makeTitleSafe( NS_MEDIAWIKI,
"Gadget-section-$section$langSuffix" );
70 [], [
'action' =>
'edit' ] )
72 $lnk =
"    [$lnkTarget]";
74 $ttext = $this->
msg(
"gadget-section-$section" )->parse();
77 $output->addHTML( Xml::closeElement(
'ul' ) .
"\n" );
81 $output->addHTML( Html::rawElement(
'h2', [], $ttext . $lnk ) .
"\n" );
87 foreach ( $entries as $gadget ) {
88 $name = $gadget->getName();
89 $t = Title::makeTitleSafe( NS_MEDIAWIKI,
"Gadget-{$name}$langSuffix" );
97 $this->
msg( $editInterfaceMessage )->
text(),
99 [
'action' =>
'edit' ]
103 $this->
msg(
'gadgets-export' )->
text()
106 $ttext = $this->
msg(
"gadget-{$name}" )->parse();
110 $output->addHTML( Xml::openElement(
'ul' ) );
113 $actions =
'  ' .
114 $this->
msg(
'parentheses' )->rawParams(
$lang->pipeList( $links ) )->escaped();
116 Xml::openElement(
'li', [
'id' => $this->
makeAnchor( $name ) ] ) .
117 $ttext . $actions .
"<br />" .
118 $this->
msg(
'gadgets-uses' )->escaped() .
119 $this->
msg(
'colon-separator' )->escaped()
123 foreach ( $gadget->getPeers() as $peer ) {
124 $lnk[] = Html::element(
126 [
'href' =>
'#' . $this->
makeAnchor( $peer ) ],
130 foreach ( $gadget->getScriptsAndStyles() as $codePage ) {
131 $t = Title::newFromText( $codePage );
140 if ( $gadget->getLegacyScripts() ) {
141 $output->addHTML(
'<br />' . Html::rawElement(
143 [
'class' =>
'mw-gadget-legacy errorbox' ],
144 $this->
msg(
'gadgets-legacy' )->parse()
149 foreach ( $gadget->getRequiredRights() as $right ) {
150 $rights[] =
'* ' . $this->
msg(
"right-$right" )->plain();
152 if ( count( $rights ) ) {
154 $this->
msg(
'gadgets-required-rights', implode(
"\n", $rights ), count( $rights ) )->parse()
158 $requiredSkins = $gadget->getRequiredSkins();
160 if ( is_array( $requiredSkins ) ) {
162 $validskins = Skin::getSkinNames();
163 foreach ( $requiredSkins as $skinid ) {
164 if ( isset( $validskins[$skinid] ) ) {
165 $skins[] = $this->
msg(
"skinname-$skinid" )->plain();
170 if ( count( $skins ) ) {
173 $this->
msg(
'gadgets-required-skins',
$lang->commaList( $skins ) )
174 ->numParams( count( $skins ) )->parse()
179 if ( $gadget->isOnByDefault() ) {
180 $output->addHTML(
'<br />' . $this->
msg(
'gadgets-default' )->parse() );
183 $output->addHTML( Xml::closeElement(
'li' ) .
"\n" );
188 $output->addHTML( Xml::closeElement(
'ul' ) .
"\n" );
202 }
catch ( InvalidArgumentException
$e ) {
203 $output->showErrorPage(
'error',
'gadgets-not-found', [ $gadget ] );
208 $output->setPageTitle( $this->
msg(
'gadgets-export-title' ) );
209 $output->addWikiMsg(
'gadgets-export-text', $gadget, $g->getDefinition() );
211 $exportList =
"MediaWiki:gadget-$gadget\n";
212 foreach ( $g->getScriptsAndStyles() as $page ) {
213 $exportList .=
"$page\n";
216 $htmlForm = HTMLForm::factory(
'ooui', [], $this->
getContext() );
219 ->addHiddenField(
'pages', $exportList )
220 ->addHiddenField(
'wpDownload',
'1' )
221 ->addHiddenField(
'templates',
'1' )
224 ->setSubmitText( $this->
msg(
'gadgets-export-download' )->
text() )
226 ->displayForm(
false );