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