blob: 0226113e2f9fa778302a2ca95a28b4b05286b210 (
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
|
<?php
namespace Maps\MediaWiki\Specials;
use Maps\GoogleMapsService;
use SpecialPage;
/**
* Special page with map editor interface using Google Maps.
*
* @since 2.0
*
* @licence GNU GPL v2+
* @author Kim Eik
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/
class SpecialMapEditor extends SpecialPage {
/**
* @see SpecialPage::__construct
*
* @since 2.0
*/
public function __construct() {
parent::__construct( 'MapEditor' );
}
/**
* @see SpecialPage::execute
*
* @since 2.0
*
* @param null|string $subPage
*/
public function execute( $subPage ) {
$this->setHeaders();
$outputPage = $this->getOutput();
$outputPage->addHtml(
GoogleMapsService::getApiScript(
$this->getLanguage()->getCode(),
[ 'libraries' => 'drawing' ]
)
);
$outputPage->addModules( 'ext.maps.wikitext.editor' );
$editorHtml = new MapEditorHtml( $this->getAttribs() );
$html = $editorHtml->getEditorHtml();
$outputPage->addHTML( $html );
}
/**
* @since 2.1
*
* @return array
*/
protected function getAttribs() {
return [
'id' => 'map-canvas',
'context' => 'Maps\MediaWiki\Specials\SpecialMapEditor'
];
}
protected function getGroupName() {
return 'maps';
}
}
|