Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
MigrateTranslatablePageSpecialPage.php
1<?php
2declare( strict_types = 1 );
3
4namespace MediaWiki\Extension\Translate\PageTranslation;
5
6use MediaWiki\Html\Html;
7use MediaWiki\Json\FormatJson;
8use MediaWiki\SpecialPage\SpecialPage;
9
15class MigrateTranslatablePageSpecialPage extends SpecialPage {
16 public function __construct() {
17 parent::__construct( 'PageMigration', 'pagetranslation' );
18 }
19
20 protected function getGroupName(): string {
21 return 'translation';
22 }
23
25 public function getDescription() {
26 return $this->msg( 'pagemigration' );
27 }
28
30 public function execute( $par ) {
31 $output = $this->getOutput();
32 $this->setHeaders();
33 $this->checkPermissions();
34 $this->addHelpLink( 'Help:Extension:Translate/Page translation administration' );
35 $this->outputHeader( 'pagemigration-summary' );
36 $output->addModules( 'ext.translate.special.pagemigration' );
37 $output->addModuleStyles( [
38 'ext.translate.specialpages.styles',
39 'jquery.uls.grid',
40 'mediawiki.codex.messagebox.styles',
41 ] );
42
43 # Do stuff
44 # ...
45 $out = '';
46 $out .= Html::openElement( 'div', [ 'class' => 'mw-tpm-sp-container grid' ] );
47 $out .= Html::openElement( 'div', [ 'class' => 'mw-tpm-sp-error row',
48 'id' => 'mw-tpm-sp-error-div' ] );
49 $out .= Html::element( 'div',
50 [ 'class' => 'mw-tpm-sp-error__message five columns hide' ] );
51 $out .= Html::closeElement( 'div' );
52 $out .= Html::openElement( 'form', [ 'class' => 'mw-tpm-sp-form row',
53 'id' => 'mw-tpm-sp-primary-form', 'action' => '' ] );
54 $out .= Html::element( 'input', [ 'id' => 'pm-summary', 'type' => 'hidden',
55 'value' => $this->msg( 'pm-summary-import' )->inContentLanguage()->text() ] );
56 $out .= "\n";
57 $out .= Html::element( 'input', [ 'id' => 'title', 'class' => 'mw-searchInput mw-ui-input',
58 'data-mw-searchsuggest' => FormatJson::encode( [
59 'wrapAsLink' => false
60 ] ), 'placeholder' => $this->msg( 'pm-pagetitle-placeholder' )->text() ] );
61 $out .= "\n";
62 $out .= Html::element( 'input', [ 'id' => 'action-import',
63 'class' => 'mw-ui-button mw-ui-progressive', 'type' => 'button',
64 'value' => $this->msg( 'pm-import-button-label' )->text() ] );
65 $out .= "\n";
66 $out .= Html::element( 'input', [ 'id' => 'action-save',
67 'class' => 'mw-ui-button mw-ui-progressive hide', 'type' => 'button',
68 'value' => $this->msg( 'pm-savepages-button-label' )->text() ] );
69 $out .= "\n";
70 $out .= Html::element( 'input', [ 'id' => 'action-cancel',
71 'class' => 'mw-ui-button mw-ui-quiet hide', 'type' => 'button',
72 'value' => $this->msg( 'pm-cancel-button-label' )->text() ] );
73 $out .= Html::closeElement( 'form' );
74 $out .= Html::element( 'div', [ 'class' => 'mw-tpm-sp-instructions hide' ] );
75 $out .= Html::rawElement( 'div', [ 'class' => 'mw-tpm-sp-unit-listing' ] );
76 $out .= Html::closeElement( 'div' );
77
78 $output->addHTML( $out );
79 $output->addHTML(
80 Html::errorBox(
81 $this->msg( 'tux-nojs' )->escaped(),
82 '',
83 'tux-nojs'
84 )
85 );
86 }
87}
Contains code for Special:PageMigration to migrate to page transation.