Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 55 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
MigrateTranslatablePageSpecialPage | |
0.00% |
0 / 55 |
|
0.00% |
0 / 4 |
30 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getGroupName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDescription | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
execute | |
0.00% |
0 / 50 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | declare( strict_types = 1 ); |
3 | |
4 | namespace MediaWiki\Extension\Translate\PageTranslation; |
5 | |
6 | use FormatJson; |
7 | use MediaWiki\Html\Html; |
8 | use SpecialPage; |
9 | |
10 | /** |
11 | * Contains code for Special:PageMigration to migrate to page transation |
12 | * @author Pratik Lahoti |
13 | * @license GPL-2.0-or-later |
14 | */ |
15 | class 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 | // Backward compatibility for < 1.41 |
26 | if ( version_compare( MW_VERSION, '1.41', '<' ) ) { |
27 | return $this->msg( 'pagemigration' )->text(); |
28 | } |
29 | return $this->msg( 'pagemigration' ); |
30 | } |
31 | |
32 | public function execute( $par ) { |
33 | $output = $this->getOutput(); |
34 | $this->setHeaders(); |
35 | $this->checkPermissions(); |
36 | $this->addHelpLink( 'Help:Extension:Translate/Page translation administration' ); |
37 | $this->outputHeader( 'pagemigration-summary' ); |
38 | $output->addModules( 'ext.translate.special.pagemigration' ); |
39 | $output->addModuleStyles( [ |
40 | 'ext.translate.specialpages.styles', |
41 | 'jquery.uls.grid' |
42 | ] ); |
43 | |
44 | # Do stuff |
45 | # ... |
46 | $out = ''; |
47 | $out .= Html::openElement( 'div', [ 'class' => 'mw-tpm-sp-container grid' ] ); |
48 | $out .= Html::openElement( 'div', [ 'class' => 'mw-tpm-sp-error row', |
49 | 'id' => 'mw-tpm-sp-error-div' ] ); |
50 | $out .= Html::element( 'div', |
51 | [ 'class' => 'mw-tpm-sp-error__message five columns hide' ] ); |
52 | $out .= Html::closeElement( 'div' ); |
53 | $out .= Html::openElement( 'form', [ 'class' => 'mw-tpm-sp-form row', |
54 | 'id' => 'mw-tpm-sp-primary-form', 'action' => '' ] ); |
55 | $out .= Html::element( 'input', [ 'id' => 'pm-summary', 'type' => 'hidden', |
56 | 'value' => $this->msg( 'pm-summary-import' )->inContentLanguage()->text() ] ); |
57 | $out .= "\n"; |
58 | $out .= Html::element( 'input', [ 'id' => 'title', 'class' => 'mw-searchInput mw-ui-input', |
59 | 'data-mw-searchsuggest' => FormatJson::encode( [ |
60 | 'wrapAsLink' => false |
61 | ] ), 'placeholder' => $this->msg( 'pm-pagetitle-placeholder' )->text() ] ); |
62 | $out .= "\n"; |
63 | $out .= Html::element( 'input', [ 'id' => 'action-import', |
64 | 'class' => 'mw-ui-button mw-ui-progressive', 'type' => 'button', |
65 | 'value' => $this->msg( 'pm-import-button-label' )->text() ] ); |
66 | $out .= "\n"; |
67 | $out .= Html::element( 'input', [ 'id' => 'action-save', |
68 | 'class' => 'mw-ui-button mw-ui-progressive hide', 'type' => 'button', |
69 | 'value' => $this->msg( 'pm-savepages-button-label' )->text() ] ); |
70 | $out .= "\n"; |
71 | $out .= Html::element( 'input', [ 'id' => 'action-cancel', |
72 | 'class' => 'mw-ui-button mw-ui-quiet hide', 'type' => 'button', |
73 | 'value' => $this->msg( 'pm-cancel-button-label' )->text() ] ); |
74 | $out .= Html::closeElement( 'form' ); |
75 | $out .= Html::element( 'div', [ 'class' => 'mw-tpm-sp-instructions hide' ] ); |
76 | $out .= Html::rawElement( 'div', [ 'class' => 'mw-tpm-sp-unit-listing' ] ); |
77 | $out .= Html::closeElement( 'div' ); |
78 | |
79 | $output->addHTML( $out ); |
80 | $output->addHTML( |
81 | Html::errorBox( |
82 | $this->msg( 'tux-nojs' )->escaped(), |
83 | '', |
84 | 'tux-nojs' |
85 | ) |
86 | ); |
87 | } |
88 | } |