blob: cd854e06b1092b1614b2d5b5a081e5ebc7806c4d (
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
|
<?php
/**
* Contains code for special page Special:PagePreparation
*
* @file
* @author Pratik Lahoti
* @copyright Copyright © 2014 Pratik Lahoti
* @license GPL-2.0-or-later
*/
class SpecialPagePreparation extends SpecialPage {
public function __construct() {
parent::__construct( 'PagePreparation', 'pagetranslation' );
}
protected function getGroupName() {
return 'wiki';
}
public function execute( $par ) {
$request = $this->getRequest();
$output = $this->getOutput();
$this->setHeaders();
$this->checkPermissions();
$inputValue = htmlspecialchars( $request->getText( 'page', $par ) );
$pagenamePlaceholder = $this->msg( 'pp-pagename-placeholder' )->escaped();
$prepareButtonValue = $this->msg( 'pp-prepare-button-label' )->escaped();
$saveButtonValue = $this->msg( 'pp-save-button-label' )->escaped();
$cancelButtonValue = $this->msg( 'pp-cancel-button-label' )->escaped();
$summaryValue = $this->msg( 'pp-save-summary' )->inContentLanguage()->escaped();
$output->addModules( 'ext.translate.special.pagepreparation' );
$output->addModuleStyles( [
'ext.translate.special.pagepreparation.styles',
'jquery.uls.grid'
] );
$out = '';
$diff = new DifferenceEngine( $this->getContext() );
$diffHeader = $diff->addHeader( ' ', $this->msg( 'pp-diff-old-header' )->escaped(),
$this->msg( 'pp-diff-new-header' )->escaped() );
$out = <<<HTML
<div class="grid">
<form class="mw-tpp-sp-form row" name="mw-tpp-sp-input-form" action="">
<input id="pp-summary" type="hidden" value="{$summaryValue}" />
<input name="page" id="page" class="mw-searchInput mw-ui-input"
placeholder="{$pagenamePlaceholder}" value="{$inputValue}"/>
<button id="action-prepare" class="mw-ui-button mw-ui-progressive" type="button">
{$prepareButtonValue}</button>
<button id="action-save" class="mw-ui-button mw-ui-progressive hide" type="button">
{$saveButtonValue}</button>
<button id="action-cancel" class="mw-ui-button mw-ui-quiet hide" type="button">
{$cancelButtonValue}</button>
</form>
<div class="messageDiv hide"></div>
<div class="divDiff hide">
{$diffHeader}
</div>
</div>
HTML;
$output->addHTML( $out );
$nojs = Html::element(
'div',
[ 'class' => 'tux-nojs errorbox' ],
$this->msg( 'tux-nojs' )->plain()
);
$output->addHTML( $nojs );
}
}
|