summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Translate/tag/SpecialPageMigration.php
blob: dc2daac73d8f76111ec8e2790b6cfc3a5ede78f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
 * Contains code for special page Special:PageMigration
 *
 * @file
 * @author Pratik Lahoti
 * @copyright Copyright © 2014-2015 Pratik Lahoti
 * @license GPL-2.0-or-later
 */

class SpecialPageMigration extends SpecialPage {
	public function __construct() {
		parent::__construct( 'PageMigration', 'pagetranslation' );
	}

	protected function getGroupName() {
		return 'wiki';
	}

	public function getDescription() {
		return $this->msg( 'pagemigration' )->text();
	}

	public function execute( $par ) {
		$request = $this->getRequest();
		$output = $this->getOutput();
		$this->setHeaders();
		$this->checkPermissions();
		$this->outputHeader( 'pagemigration-summary' );
		$output->addModules( 'ext.translate.special.pagemigration' );
		$output->addModuleStyles( [
			'ext.translate.special.pagemigration.styles',
			'jquery.uls.grid'
		] );
		# Get request data from, e.g.
		$param = $request->getText( 'param' );
		# Do stuff
		# ...
		$out = '';
		$out .= Html::openElement( 'div', [ 'class' => 'grid' ] );
		$out .= Html::openElement( 'div', [ 'class' => 'mw-tpm-sp-error row',
			'id' => 'mw-tpm-sp-error-div' ] );
		$out .= Html::element( 'div',
			[ 'class' => 'mw-tpm-sp-error__message five columns hide' ] );
		$out .= Html::closeElement( 'div' );
		$out .= Html::openElement( 'form', [ 'class' => 'mw-tpm-sp-form row',
			'id' => 'mw-tpm-sp-primary-form', 'action' => '' ] );
		$out .= Html::element( 'input', [ 'id' => 'pm-summary', 'type' => 'hidden',
			'value' => $this->msg( 'pm-summary-import' )->inContentLanguage()->text() ] );
		$out .= "\n";
		$out .= Html::element( 'input', [ 'id' => 'title', 'class' => 'mw-searchInput mw-ui-input',
			'data-mw-searchsuggest' => FormatJson::encode( [
				'wrapAsLink' => false
			] ), 'placeholder' => $this->msg( 'pm-pagetitle-placeholder' )->text() ] );
		$out .= "\n";
		$out .= Html::element( 'input', [ 'id' => 'action-import',
			'class' => 'mw-ui-button mw-ui-progressive', 'type' => 'button',
			'value' => $this->msg( 'pm-import-button-label' )->text() ] );
		$out .= "\n";
		$out .= Html::element( 'input', [ 'id' => 'action-save',
			'class' => 'mw-ui-button mw-ui-progressive hide', 'type' => 'button',
			'value' => $this->msg( 'pm-savepages-button-label' )->text() ] );
		$out .= "\n";
		$out .= Html::element( 'input', [ 'id' => 'action-cancel',
			'class' => 'mw-ui-button mw-ui-quiet hide', 'type' => 'button',
			'value' => $this->msg( 'pm-cancel-button-label' )->text() ] );
		$out .= Html::closeElement( 'form' );
		$out .= Html::element( 'div', [ 'class' => 'mw-tpm-sp-instructions hide' ] );
		$out .= Html::openElement( 'div', [ 'class' => 'mw-tpm-sp-unit-listing' ] );
		$out .= Html::closeElement( 'div' );
		$out .= Html::closeElement( 'div' );

		$output->addHTML( $out );

		$nojs = Html::element(
			'div',
			[ 'class' => 'tux-nojs errorbox' ],
			$this->msg( 'tux-nojs' )->plain()
		);
		$output->addHTML( $nojs );
	}
}