r63780 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63779‎ | r63780 | r63781 >
Date:20:15, 15 March 2010
Author:ialex
Status:ok
Tags:
Comment:
svn:eol-style native
Modified paths:
  • /trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersFormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSMFormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFormInput.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFormInput.php
@@ -1,92 +1,92 @@
2 -<?php
3 -
4 -/**
5 -* Form input hook that adds an Yahoo! Maps map format to Semantic Forms
6 - *
7 - * @file SM_YahooMapsFormInput.php
8 - * @ingroup SMYahooMaps
9 - *
10 - * @author Jeroen De Dauw
11 - */
12 -
13 -if ( !defined( 'MEDIAWIKI' ) ) {
14 - die( 'Not an entry point.' );
15 -}
16 -
17 -final class SMYahooMapsFormInput extends SMFormInput {
18 -
19 - public $serviceName = MapsYahooMaps::SERVICE_NAME;
20 -
21 - /**
22 - * @see MapsMapFeature::setMapSettings()
23 - *
24 - */
25 - protected function setMapSettings() {
26 - global $egMapsYahooMapsZoom, $egMapsYahooMapsPrefix;
27 -
28 - $this->elementNamePrefix = $egMapsYahooMapsPrefix;
29 - $this->showAddresFunction = 'showYAddress';
30 -
31 - $this->earthZoom = 17;
32 -
33 - $this->defaultZoom = $egMapsYahooMapsZoom;
34 - }
35 -
36 - /**
37 - * @see MapsMapFeature::addFormDependencies()
38 - *
39 - */
40 - protected function addFormDependencies() {
41 - global $wgJsMimeType;
42 - global $smgScriptPath, $smgYahooFormsOnThisPage, $smgStyleVersion;
43 -
44 - MapsYahooMaps::addYMapDependencies( $this->output );
45 -
46 - if ( empty( $smgYahooFormsOnThisPage ) ) {
47 - $smgYahooFormsOnThisPage = 0;
48 - $this->output .= "<script type='$wgJsMimeType' src='$smgScriptPath/YahooMaps/SM_YahooMapsFunctions.js?$smgStyleVersion'></script>";
49 - }
50 - }
51 -
52 - /**
53 - * @see MapsMapFeature::doMapServiceLoad()
54 - *
55 - */
56 - protected function doMapServiceLoad() {
57 - global $egYahooMapsOnThisPage, $smgYahooFormsOnThisPage;
58 -
59 - self::addFormDependencies();
60 -
61 - $egYahooMapsOnThisPage++;
62 - $smgYahooFormsOnThisPage++;
63 -
64 - $this->elementNr = $egYahooMapsOnThisPage;
65 - }
66 -
67 - /**
68 - * @see MapsMapFeature::addSpecificMapHTML()
69 - *
70 - */
71 - protected function addSpecificMapHTML() {
72 - global $wgJsMimeType;
73 -
74 - $this->output .= "
75 - <div id='" . $this->mapName . "' style='width: {$this->width}px; height: {$this->height}px;'></div>
76 -
77 - <script type='$wgJsMimeType'>/*<![CDATA[*/
78 - addOnloadHook(function() {makeFormInputYahooMap('$this->mapName', '$this->coordsFieldName', $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$this->types], [$this->controls], $this->autozoom, $this->marker_lat, $this->centre_lon, $this->height);});
79 - /*]]>*/</script>";
80 - }
81 -
82 - /**
83 - * @see SMFormInput::manageGeocoding()
84 - *
85 - */
86 - protected function manageGeocoding() {
87 - global $egYahooMapsKey;
88 - $this->enableGeocoding = strlen( trim( $egYahooMapsKey ) ) > 0;
89 - if ( $this->enableGeocoding ) MapsYahooMaps::addYMapDependencies( $this->output );
90 - }
91 -
92 -
93 -}
 2+<?php
 3+
 4+/**
 5+* Form input hook that adds an Yahoo! Maps map format to Semantic Forms
 6+ *
 7+ * @file SM_YahooMapsFormInput.php
 8+ * @ingroup SMYahooMaps
 9+ *
 10+ * @author Jeroen De Dauw
 11+ */
 12+
 13+if ( !defined( 'MEDIAWIKI' ) ) {
 14+ die( 'Not an entry point.' );
 15+}
 16+
 17+final class SMYahooMapsFormInput extends SMFormInput {
 18+
 19+ public $serviceName = MapsYahooMaps::SERVICE_NAME;
 20+
 21+ /**
 22+ * @see MapsMapFeature::setMapSettings()
 23+ *
 24+ */
 25+ protected function setMapSettings() {
 26+ global $egMapsYahooMapsZoom, $egMapsYahooMapsPrefix;
 27+
 28+ $this->elementNamePrefix = $egMapsYahooMapsPrefix;
 29+ $this->showAddresFunction = 'showYAddress';
 30+
 31+ $this->earthZoom = 17;
 32+
 33+ $this->defaultZoom = $egMapsYahooMapsZoom;
 34+ }
 35+
 36+ /**
 37+ * @see MapsMapFeature::addFormDependencies()
 38+ *
 39+ */
 40+ protected function addFormDependencies() {
 41+ global $wgJsMimeType;
 42+ global $smgScriptPath, $smgYahooFormsOnThisPage, $smgStyleVersion;
 43+
 44+ MapsYahooMaps::addYMapDependencies( $this->output );
 45+
 46+ if ( empty( $smgYahooFormsOnThisPage ) ) {
 47+ $smgYahooFormsOnThisPage = 0;
 48+ $this->output .= "<script type='$wgJsMimeType' src='$smgScriptPath/YahooMaps/SM_YahooMapsFunctions.js?$smgStyleVersion'></script>";
 49+ }
 50+ }
 51+
 52+ /**
 53+ * @see MapsMapFeature::doMapServiceLoad()
 54+ *
 55+ */
 56+ protected function doMapServiceLoad() {
 57+ global $egYahooMapsOnThisPage, $smgYahooFormsOnThisPage;
 58+
 59+ self::addFormDependencies();
 60+
 61+ $egYahooMapsOnThisPage++;
 62+ $smgYahooFormsOnThisPage++;
 63+
 64+ $this->elementNr = $egYahooMapsOnThisPage;
 65+ }
 66+
 67+ /**
 68+ * @see MapsMapFeature::addSpecificMapHTML()
 69+ *
 70+ */
 71+ protected function addSpecificMapHTML() {
 72+ global $wgJsMimeType;
 73+
 74+ $this->output .= "
 75+ <div id='" . $this->mapName . "' style='width: {$this->width}px; height: {$this->height}px;'></div>
 76+
 77+ <script type='$wgJsMimeType'>/*<![CDATA[*/
 78+ addOnloadHook(function() {makeFormInputYahooMap('$this->mapName', '$this->coordsFieldName', $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$this->types], [$this->controls], $this->autozoom, $this->marker_lat, $this->centre_lon, $this->height);});
 79+ /*]]>*/</script>";
 80+ }
 81+
 82+ /**
 83+ * @see SMFormInput::manageGeocoding()
 84+ *
 85+ */
 86+ protected function manageGeocoding() {
 87+ global $egYahooMapsKey;
 88+ $this->enableGeocoding = strlen( trim( $egYahooMapsKey ) ) > 0;
 89+ if ( $this->enableGeocoding ) MapsYahooMaps::addYMapDependencies( $this->output );
 90+ }
 91+
 92+
 93+}
Property changes on: trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFormInput.php
___________________________________________________________________
Name: svn:eol-style
9494 + native
Index: trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersFormInput.php
@@ -1,90 +1,90 @@
2 -<?php
3 -
4 -/**
5 - * Form input hook that adds an Open Layers map format to Semantic Forms
6 - *
7 - * @file SM_OpenLayersFormInput.php
8 - * @ingroup SMOpenLayers
9 - *
10 - * @author Jeroen De Dauw
11 - */
12 -
13 -if ( !defined( 'MEDIAWIKI' ) ) {
14 - die( 'Not an entry point.' );
15 -}
16 -
17 -final class SMOpenLayersFormInput extends SMFormInput {
18 -
19 - public $serviceName = MapsOpenLayers::SERVICE_NAME;
20 -
21 - /**
22 - * @see MapsMapFeature::setMapSettings()
23 - *
24 - */
25 - protected function setMapSettings() {
26 - global $egMapsOpenLayersZoom, $egMapsOpenLayersPrefix;
27 -
28 - $this->elementNamePrefix = $egMapsOpenLayersPrefix;
29 -
30 - $this->earthZoom = 1;
31 -
32 - $this->defaultZoom = $egMapsOpenLayersZoom;
33 - }
34 -
35 - /**
36 - * @see MapsMapFeature::addFormDependencies()
37 - *
38 - */
39 - protected function addFormDependencies() {
40 - global $wgJsMimeType;
41 - global $smgScriptPath, $smgOLFormsOnThisPage, $smgStyleVersion;
42 -
43 - MapsOpenLayers::addOLDependencies( $this->output );
44 -
45 - if ( empty( $smgOLFormsOnThisPage ) ) {
46 - $smgOLFormsOnThisPage = 0;
47 - $this->output .= "<script type='$wgJsMimeType' src='$smgScriptPath/OpenLayers/SM_OpenLayersFunctions.js?$smgStyleVersion'></script>";
48 - }
49 - }
50 -
51 - /**
52 - * @see MapsMapFeature::doMapServiceLoad()
53 - *
54 - */
55 - protected function doMapServiceLoad() {
56 - global $egOpenLayersOnThisPage, $smgOLFormsOnThisPage;
57 -
58 - self::addFormDependencies();
59 -
60 - $egOpenLayersOnThisPage++;
61 - $smgOLFormsOnThisPage++;
62 -
63 - $this->elementNr = $egOpenLayersOnThisPage;
64 - }
65 -
66 - /**
67 - * @see MapsMapFeature::addSpecificMapHTML()
68 - *
69 - */
70 - protected function addSpecificMapHTML() {
71 - global $wgJsMimeType;
72 -
73 - $layerItems = MapsOpenLayers::createLayersStringAndLoadDependencies( $this->output, $this->layers );
74 -
75 - $this->output .= "
76 - <div id='" . $this->mapName . "' style='width: {$this->width}px; height: {$this->height}px; background-color: #cccccc;'></div>
77 -
78 - <script type='$wgJsMimeType'>/*<![CDATA[*/
79 - addOnloadHook(function() {makeFormInputOpenLayer('" . $this->mapName . "', '" . $this->coordsFieldName . "', " . $this->centre_lat . ", " . $this->centre_lon . ", " . $this->zoom . ", " . $this->marker_lat . ", " . $this->marker_lon . ", [$layerItems], [$this->controls], $this->height);});
80 - /*]]>*/</script>";
81 - }
82 -
83 - /**
84 - * @see SMFormInput::manageGeocoding()
85 - *
86 - */
87 - protected function manageGeocoding() {
88 - $this->enableGeocoding = false;
89 - }
90 -
91 -}
 2+<?php
 3+
 4+/**
 5+ * Form input hook that adds an Open Layers map format to Semantic Forms
 6+ *
 7+ * @file SM_OpenLayersFormInput.php
 8+ * @ingroup SMOpenLayers
 9+ *
 10+ * @author Jeroen De Dauw
 11+ */
 12+
 13+if ( !defined( 'MEDIAWIKI' ) ) {
 14+ die( 'Not an entry point.' );
 15+}
 16+
 17+final class SMOpenLayersFormInput extends SMFormInput {
 18+
 19+ public $serviceName = MapsOpenLayers::SERVICE_NAME;
 20+
 21+ /**
 22+ * @see MapsMapFeature::setMapSettings()
 23+ *
 24+ */
 25+ protected function setMapSettings() {
 26+ global $egMapsOpenLayersZoom, $egMapsOpenLayersPrefix;
 27+
 28+ $this->elementNamePrefix = $egMapsOpenLayersPrefix;
 29+
 30+ $this->earthZoom = 1;
 31+
 32+ $this->defaultZoom = $egMapsOpenLayersZoom;
 33+ }
 34+
 35+ /**
 36+ * @see MapsMapFeature::addFormDependencies()
 37+ *
 38+ */
 39+ protected function addFormDependencies() {
 40+ global $wgJsMimeType;
 41+ global $smgScriptPath, $smgOLFormsOnThisPage, $smgStyleVersion;
 42+
 43+ MapsOpenLayers::addOLDependencies( $this->output );
 44+
 45+ if ( empty( $smgOLFormsOnThisPage ) ) {
 46+ $smgOLFormsOnThisPage = 0;
 47+ $this->output .= "<script type='$wgJsMimeType' src='$smgScriptPath/OpenLayers/SM_OpenLayersFunctions.js?$smgStyleVersion'></script>";
 48+ }
 49+ }
 50+
 51+ /**
 52+ * @see MapsMapFeature::doMapServiceLoad()
 53+ *
 54+ */
 55+ protected function doMapServiceLoad() {
 56+ global $egOpenLayersOnThisPage, $smgOLFormsOnThisPage;
 57+
 58+ self::addFormDependencies();
 59+
 60+ $egOpenLayersOnThisPage++;
 61+ $smgOLFormsOnThisPage++;
 62+
 63+ $this->elementNr = $egOpenLayersOnThisPage;
 64+ }
 65+
 66+ /**
 67+ * @see MapsMapFeature::addSpecificMapHTML()
 68+ *
 69+ */
 70+ protected function addSpecificMapHTML() {
 71+ global $wgJsMimeType;
 72+
 73+ $layerItems = MapsOpenLayers::createLayersStringAndLoadDependencies( $this->output, $this->layers );
 74+
 75+ $this->output .= "
 76+ <div id='" . $this->mapName . "' style='width: {$this->width}px; height: {$this->height}px; background-color: #cccccc;'></div>
 77+
 78+ <script type='$wgJsMimeType'>/*<![CDATA[*/
 79+ addOnloadHook(function() {makeFormInputOpenLayer('" . $this->mapName . "', '" . $this->coordsFieldName . "', " . $this->centre_lat . ", " . $this->centre_lon . ", " . $this->zoom . ", " . $this->marker_lat . ", " . $this->marker_lon . ", [$layerItems], [$this->controls], $this->height);});
 80+ /*]]>*/</script>";
 81+ }
 82+
 83+ /**
 84+ * @see SMFormInput::manageGeocoding()
 85+ *
 86+ */
 87+ protected function manageGeocoding() {
 88+ $this->enableGeocoding = false;
 89+ }
 90+
 91+}
Property changes on: trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersFormInput.php
___________________________________________________________________
Name: svn:eol-style
9292 + native
Index: trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSMFormInput.php
@@ -1,109 +1,109 @@
2 -<?php
3 -
4 -/**
5 - * Form input hook that adds an OSM map format to Semantic Forms
6 - *
7 - * @file SM_OSMFormInput.php
8 - * @ingroup SMOSM
9 - *
10 - * @author Jeroen De Dauw
11 - */
12 -
13 -if ( !defined( 'MEDIAWIKI' ) ) {
14 - die( 'Not an entry point.' );
15 -}
16 -
17 -// TODO: the js for this form input does not work yet. Requires fixing before the FI can be enabled.
18 -
19 -final class SMOSMFormInput extends SMFormInput {
20 -
21 - public $serviceName = MapsOSM::SERVICE_NAME;
22 -
23 - /**
24 - * @see MapsMapFeature::setMapSettings()
25 - *
26 - */
27 - protected function setMapSettings() {
28 - global $egMapsOSMZoom, $egMapsOSMPrefix;
29 -
30 - $this->elementNamePrefix = $egMapsOSMPrefix;
31 -
32 - $this->earthZoom = 1;
33 -
34 - $this->defaultZoom = $egMapsOSMZoom;
35 - }
36 -
37 - /**
38 - * @see MapsMapFeature::addFormDependencies()
39 - *
40 - */
41 - protected function addFormDependencies() {
42 - global $wgJsMimeType;
43 - global $smgScriptPath, $smgOSMFormsOnThisPage, $smgStyleVersion;
44 -
45 - MapsOSM::addOSMDependencies( $this->output );
46 -
47 - if ( empty( $smgOSMFormsOnThisPage ) ) {
48 - $smgOSMFormsOnThisPage = 0;
49 - $this->output .= "<script type='$wgJsMimeType' src='$smgScriptPath/OpenStreetMap/SM_OSMFunctions.js?$smgStyleVersion'></script>";
50 - }
51 - }
52 -
53 - /**
54 - * @see MapsMapFeature::doMapServiceLoad()
55 - *
56 - */
57 - protected function doMapServiceLoad() {
58 - global $egOSMMapsOnThisPage, $smgOSMFormsOnThisPage;
59 -
60 - self::addFormDependencies();
61 -
62 - $egOSMMapsOnThisPage++;
63 - $smgOSMFormsOnThisPage++;
64 -
65 - $this->elementNr = $egOSMMapsOnThisPage;
66 - }
67 -
68 - /**
69 - * @see MapsMapFeature::addSpecificMapHTML()
70 - *
71 - */
72 - protected function addSpecificMapHTML() {
73 - global $wgJsMimeType;
74 -
75 - $this->output .= <<<EOT
76 - <script type='$wgJsMimeType'>
77 - makeOSMFormInput(
78 - '$this->mapName',
79 - '$this->coordsFieldName',
80 - {
81 - mode: 'osm-wm',
82 - layer: 'osm-like',
83 - locale: '$this->lang',
84 - lat: $this->centre_lat,
85 - lon: $this->centre_lon,
86 - zoom: $this->zoom,
87 - width: $this->width,
88 - height: $this->height,
89 - controls: [$this->controls],
90 - }
91 - );
92 -
93 -
94 - </script>
95 -
96 - <div id='$this->mapName' class='map' style='width:{$this->width}px; height:{$this->height}px;'>
97 - <script type='$wgJsMimeType'>slippymaps['$this->mapName'].init();</script>
98 - </div>
99 -EOT;
100 - }
101 -
102 - /**
103 - * @see SMFormInput::manageGeocoding()
104 - *
105 - */
106 - protected function manageGeocoding() {
107 - $this->enableGeocoding = false;
108 - }
109 -
110 -}
 2+<?php
 3+
 4+/**
 5+ * Form input hook that adds an OSM map format to Semantic Forms
 6+ *
 7+ * @file SM_OSMFormInput.php
 8+ * @ingroup SMOSM
 9+ *
 10+ * @author Jeroen De Dauw
 11+ */
 12+
 13+if ( !defined( 'MEDIAWIKI' ) ) {
 14+ die( 'Not an entry point.' );
 15+}
 16+
 17+// TODO: the js for this form input does not work yet. Requires fixing before the FI can be enabled.
 18+
 19+final class SMOSMFormInput extends SMFormInput {
 20+
 21+ public $serviceName = MapsOSM::SERVICE_NAME;
 22+
 23+ /**
 24+ * @see MapsMapFeature::setMapSettings()
 25+ *
 26+ */
 27+ protected function setMapSettings() {
 28+ global $egMapsOSMZoom, $egMapsOSMPrefix;
 29+
 30+ $this->elementNamePrefix = $egMapsOSMPrefix;
 31+
 32+ $this->earthZoom = 1;
 33+
 34+ $this->defaultZoom = $egMapsOSMZoom;
 35+ }
 36+
 37+ /**
 38+ * @see MapsMapFeature::addFormDependencies()
 39+ *
 40+ */
 41+ protected function addFormDependencies() {
 42+ global $wgJsMimeType;
 43+ global $smgScriptPath, $smgOSMFormsOnThisPage, $smgStyleVersion;
 44+
 45+ MapsOSM::addOSMDependencies( $this->output );
 46+
 47+ if ( empty( $smgOSMFormsOnThisPage ) ) {
 48+ $smgOSMFormsOnThisPage = 0;
 49+ $this->output .= "<script type='$wgJsMimeType' src='$smgScriptPath/OpenStreetMap/SM_OSMFunctions.js?$smgStyleVersion'></script>";
 50+ }
 51+ }
 52+
 53+ /**
 54+ * @see MapsMapFeature::doMapServiceLoad()
 55+ *
 56+ */
 57+ protected function doMapServiceLoad() {
 58+ global $egOSMMapsOnThisPage, $smgOSMFormsOnThisPage;
 59+
 60+ self::addFormDependencies();
 61+
 62+ $egOSMMapsOnThisPage++;
 63+ $smgOSMFormsOnThisPage++;
 64+
 65+ $this->elementNr = $egOSMMapsOnThisPage;
 66+ }
 67+
 68+ /**
 69+ * @see MapsMapFeature::addSpecificMapHTML()
 70+ *
 71+ */
 72+ protected function addSpecificMapHTML() {
 73+ global $wgJsMimeType;
 74+
 75+ $this->output .= <<<EOT
 76+ <script type='$wgJsMimeType'>
 77+ makeOSMFormInput(
 78+ '$this->mapName',
 79+ '$this->coordsFieldName',
 80+ {
 81+ mode: 'osm-wm',
 82+ layer: 'osm-like',
 83+ locale: '$this->lang',
 84+ lat: $this->centre_lat,
 85+ lon: $this->centre_lon,
 86+ zoom: $this->zoom,
 87+ width: $this->width,
 88+ height: $this->height,
 89+ controls: [$this->controls],
 90+ }
 91+ );
 92+
 93+
 94+ </script>
 95+
 96+ <div id='$this->mapName' class='map' style='width:{$this->width}px; height:{$this->height}px;'>
 97+ <script type='$wgJsMimeType'>slippymaps['$this->mapName'].init();</script>
 98+ </div>
 99+EOT;
 100+ }
 101+
 102+ /**
 103+ * @see SMFormInput::manageGeocoding()
 104+ *
 105+ */
 106+ protected function manageGeocoding() {
 107+ $this->enableGeocoding = false;
 108+ }
 109+
 110+}
Property changes on: trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSMFormInput.php
___________________________________________________________________
Name: svn:eol-style
111111 + native
Index: trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFormInput.php
@@ -1,119 +1,119 @@
2 -<?php
3 -
4 -/**
5 - * A class that holds static helper functions and extension hooks for the Google Maps service
6 - *
7 - * @file SM_GoogleMapsFormInput.php
8 - * @ingroup SMGoogleMaps
9 - *
10 - * @author Robert Buzink
11 - * @author Yaron Koren
12 - * @author Jeroen De Dauw
13 - */
14 -
15 -if ( !defined( 'MEDIAWIKI' ) ) {
16 - die( 'Not an entry point.' );
17 -}
18 -
19 -final class SMGoogleMapsFormInput extends SMFormInput {
20 -
21 - public $serviceName = MapsGoogleMaps::SERVICE_NAME;
22 -
23 - /**
24 - * @see MapsMapFeature::setMapSettings()
25 - *
26 - */
27 - protected function setMapSettings() {
28 - global $egMapsGoogleMapsZoom, $egMapsGoogleMapsPrefix;
29 -
30 - $this->elementNamePrefix = $egMapsGoogleMapsPrefix;
31 - $this->showAddresFunction = 'showGAddress';
32 -
33 - $this->earthZoom = 1;
34 -
35 - $this->defaultZoom = $egMapsGoogleMapsZoom;
36 - }
37 -
38 - /**
39 - * (non-PHPdoc)
40 - * @see smw/extensions/SemanticMaps/FormInputs/SMFormInput#addFormDependencies()
41 - */
42 - protected function addFormDependencies() {
43 - global $wgJsMimeType;
44 - global $smgScriptPath, $smgGoogleFormsOnThisPage, $smgStyleVersion;
45 -
46 - MapsGoogleMaps::addGMapDependencies( $this->output );
47 -
48 - if ( empty( $smgGoogleFormsOnThisPage ) ) {
49 - $smgGoogleFormsOnThisPage = 0;
50 - $this->output .= "<script type='$wgJsMimeType' src='$smgScriptPath/GoogleMaps/SM_GoogleMapsFunctions.js?$smgStyleVersion'></script>";
51 - }
52 - }
53 -
54 - /**
55 - * @see MapsMapFeature::doMapServiceLoad()
56 - *
57 - */
58 - protected function doMapServiceLoad() {
59 - global $egGoogleMapsOnThisPage, $smgGoogleFormsOnThisPage;
60 -
61 - self::addFormDependencies();
62 -
63 - $egGoogleMapsOnThisPage++;
64 - $smgGoogleFormsOnThisPage++;
65 -
66 - $this->elementNr = $egGoogleMapsOnThisPage;
67 - }
68 -
69 - /**
70 - * @see MapsMapFeature::addSpecificFormInputHTML()
71 - *
72 - */
73 - protected function addSpecificMapHTML() {
74 - global $wgJsMimeType;
75 -
76 - // Remove the overlays control in case it's present.
77 - if ( in_string( 'overlays', $this->controls ) ) {
78 - $this->controls = str_replace( ",'overlays'", '', $this->controls );
79 - $this->controls = str_replace( "'overlays',", '', $this->controls );
80 - }
81 -
82 - $this->output .= "
83 - <div id='" . $this->mapName . "'></div>
84 -
85 - <script type='$wgJsMimeType'>/*<![CDATA[*/
86 - addOnloadHook(
87 - function() {
88 - makeGoogleMapFormInput(
89 - '$this->mapName',
90 - '$this->coordsFieldName',
91 - {
92 - width: $this->width,
93 - height: $this->height,
94 - lat: $this->centre_lat,
95 - lon: $this->centre_lon,
96 - zoom: $this->zoom,
97 - type: $this->type,
98 - types: [$this->types],
99 - controls: [$this->controls],
100 - scrollWheelZoom: $this->autozoom
101 - },
102 - $this->marker_lat,
103 - $this->marker_lon
104 - );
105 - }
106 - );
107 - /*]]>*/</script>";
108 - }
109 -
110 - /**
111 - * @see SMFormInput::manageGeocoding()
112 - *
113 - */
114 - protected function manageGeocoding() {
115 - global $egGoogleMapsKey;
116 - $this->enableGeocoding = strlen( trim( $egGoogleMapsKey ) ) > 0;
117 - if ( $this->enableGeocoding ) MapsGoogleMaps::addGMapDependencies( $this->output );
118 - }
119 -
120 -}
 2+<?php
 3+
 4+/**
 5+ * A class that holds static helper functions and extension hooks for the Google Maps service
 6+ *
 7+ * @file SM_GoogleMapsFormInput.php
 8+ * @ingroup SMGoogleMaps
 9+ *
 10+ * @author Robert Buzink
 11+ * @author Yaron Koren
 12+ * @author Jeroen De Dauw
 13+ */
 14+
 15+if ( !defined( 'MEDIAWIKI' ) ) {
 16+ die( 'Not an entry point.' );
 17+}
 18+
 19+final class SMGoogleMapsFormInput extends SMFormInput {
 20+
 21+ public $serviceName = MapsGoogleMaps::SERVICE_NAME;
 22+
 23+ /**
 24+ * @see MapsMapFeature::setMapSettings()
 25+ *
 26+ */
 27+ protected function setMapSettings() {
 28+ global $egMapsGoogleMapsZoom, $egMapsGoogleMapsPrefix;
 29+
 30+ $this->elementNamePrefix = $egMapsGoogleMapsPrefix;
 31+ $this->showAddresFunction = 'showGAddress';
 32+
 33+ $this->earthZoom = 1;
 34+
 35+ $this->defaultZoom = $egMapsGoogleMapsZoom;
 36+ }
 37+
 38+ /**
 39+ * (non-PHPdoc)
 40+ * @see smw/extensions/SemanticMaps/FormInputs/SMFormInput#addFormDependencies()
 41+ */
 42+ protected function addFormDependencies() {
 43+ global $wgJsMimeType;
 44+ global $smgScriptPath, $smgGoogleFormsOnThisPage, $smgStyleVersion;
 45+
 46+ MapsGoogleMaps::addGMapDependencies( $this->output );
 47+
 48+ if ( empty( $smgGoogleFormsOnThisPage ) ) {
 49+ $smgGoogleFormsOnThisPage = 0;
 50+ $this->output .= "<script type='$wgJsMimeType' src='$smgScriptPath/GoogleMaps/SM_GoogleMapsFunctions.js?$smgStyleVersion'></script>";
 51+ }
 52+ }
 53+
 54+ /**
 55+ * @see MapsMapFeature::doMapServiceLoad()
 56+ *
 57+ */
 58+ protected function doMapServiceLoad() {
 59+ global $egGoogleMapsOnThisPage, $smgGoogleFormsOnThisPage;
 60+
 61+ self::addFormDependencies();
 62+
 63+ $egGoogleMapsOnThisPage++;
 64+ $smgGoogleFormsOnThisPage++;
 65+
 66+ $this->elementNr = $egGoogleMapsOnThisPage;
 67+ }
 68+
 69+ /**
 70+ * @see MapsMapFeature::addSpecificFormInputHTML()
 71+ *
 72+ */
 73+ protected function addSpecificMapHTML() {
 74+ global $wgJsMimeType;
 75+
 76+ // Remove the overlays control in case it's present.
 77+ if ( in_string( 'overlays', $this->controls ) ) {
 78+ $this->controls = str_replace( ",'overlays'", '', $this->controls );
 79+ $this->controls = str_replace( "'overlays',", '', $this->controls );
 80+ }
 81+
 82+ $this->output .= "
 83+ <div id='" . $this->mapName . "'></div>
 84+
 85+ <script type='$wgJsMimeType'>/*<![CDATA[*/
 86+ addOnloadHook(
 87+ function() {
 88+ makeGoogleMapFormInput(
 89+ '$this->mapName',
 90+ '$this->coordsFieldName',
 91+ {
 92+ width: $this->width,
 93+ height: $this->height,
 94+ lat: $this->centre_lat,
 95+ lon: $this->centre_lon,
 96+ zoom: $this->zoom,
 97+ type: $this->type,
 98+ types: [$this->types],
 99+ controls: [$this->controls],
 100+ scrollWheelZoom: $this->autozoom
 101+ },
 102+ $this->marker_lat,
 103+ $this->marker_lon
 104+ );
 105+ }
 106+ );
 107+ /*]]>*/</script>";
 108+ }
 109+
 110+ /**
 111+ * @see SMFormInput::manageGeocoding()
 112+ *
 113+ */
 114+ protected function manageGeocoding() {
 115+ global $egGoogleMapsKey;
 116+ $this->enableGeocoding = strlen( trim( $egGoogleMapsKey ) ) > 0;
 117+ if ( $this->enableGeocoding ) MapsGoogleMaps::addGMapDependencies( $this->output );
 118+ }
 119+
 120+}
Property changes on: trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFormInput.php
___________________________________________________________________
Name: svn:eol-style
121121 + native

Status & tagging log