r61283 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61282‎ | r61283 | r61284 >
Date:01:55, 20 January 2010
Author:jeroendedauw
Status:deferred (Comments)
Tags:
Comment:
Changes for 0.5.3.
* Google Maps v3 support
Modified paths:
  • /trunk/extensions/Maps/GoogleMaps/GoogleMapFunctions.js (modified) (history)
  • /trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php (modified) (history)
  • /trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php (modified) (history)
  • /trunk/extensions/Maps/GoogleMaps3 (added) (history)
  • /trunk/extensions/Maps/GoogleMaps3/GoogleMap3Functions.js (added) (history)
  • /trunk/extensions/Maps/GoogleMaps3/GoogleMap3Functions.min.js (added) (history)
  • /trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3.php (added) (history)
  • /trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3DispMap.php (added) (history)
  • /trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3DispPoint.php (added) (history)

Diff [purge]

Index: trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3DispPoint.php
@@ -0,0 +1,70 @@
 2+<?php
 3+
 4+/**
 5+ * File holding the MapsGoogleMaps3DispPoint class.
 6+ *
 7+ * @file Maps_GoogleMaps3DispPoint.php
 8+ * @ingroup MapsGoogleMaps3
 9+ *
 10+ * @author Jeroen De Dauw
 11+ */
 12+
 13+if( !defined( 'MEDIAWIKI' ) ) {
 14+ die( 'Not an entry point.' );
 15+}
 16+
 17+/**
 18+ * Class for handling the display_point(s) parser functions with Google Maps v3.
 19+ *
 20+ * @ingroup MapsGoogleMaps3
 21+ *
 22+ * @author Jeroen De Dauw
 23+ */
 24+final class MapsGoogleMaps3DispPoint extends MapsBasePointMap {
 25+
 26+ public $serviceName = MapsGoogleMaps3::SERVICE_NAME;
 27+
 28+ /**
 29+ * @see MapsBaseMap::setMapSettings()
 30+ *
 31+ */
 32+ protected function setMapSettings() {
 33+ global $egMapsGoogleMaps3Zoom, $egMapsGoogleMaps3Prefix;
 34+
 35+ $this->elementNamePrefix = $egMapsGoogleMaps3Prefix;
 36+ $this->defaultZoom = $egMapsGoogleMaps3Zoom;
 37+
 38+ $this->markerStringFormat = ''; // TODO
 39+
 40+ $this->spesificParameters = array(
 41+ );
 42+ }
 43+
 44+ /**
 45+ * @see MapsBaseMap::doMapServiceLoad()
 46+ *
 47+ */
 48+ protected function doMapServiceLoad() {
 49+ global $egGoogleMaps3OnThisPage;
 50+
 51+ MapsGoogleMaps3::addGMap3Dependencies($this->output);
 52+ $egGoogleMaps3OnThisPage++;
 53+
 54+ $this->elementNr = $egGoogleMaps3OnThisPage;
 55+ }
 56+
 57+ /**
 58+ * @see MapsBaseMap::addSpecificMapHTML()
 59+ *
 60+ */
 61+ public function addSpecificMapHTML() {
 62+ global $wgJsMimeType;
 63+
 64+ $this->output .=<<<END
 65+
 66+END;
 67+
 68+ }
 69+
 70+}
 71+
Index: trunk/extensions/Maps/GoogleMaps3/GoogleMap3Functions.js
@@ -0,0 +1,10 @@
 2+ /**
 3+ * Javascript functions for Google Maps v3 functionallity in Maps.
 4+ *
 5+ * @file GoogleMap3Functions.js
 6+ * @ingroup MapsGoogleMaps3
 7+ *
 8+ * @author Jeroen De Dauw
 9+ */
 10+
 11+// TODO
\ No newline at end of file
Index: trunk/extensions/Maps/GoogleMaps3/GoogleMap3Functions.min.js
Index: trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3DispMap.php
@@ -0,0 +1,69 @@
 2+<?php
 3+
 4+/**
 5+ * Class for handling the display_map parser function with Google Maps v3.
 6+ *
 7+ * @file Maps_GoogleMaps3DispMap.php
 8+ * @ingroup MapsGoogleMaps3
 9+ *
 10+ * @author Jeroen De Dauw
 11+ */
 12+
 13+if( !defined( 'MEDIAWIKI' ) ) {
 14+ die( 'Not an entry point.' );
 15+}
 16+
 17+/**
 18+ * Class for handling the display_map parser functions with Google Maps v3.
 19+ *
 20+ * @ingroup MapsGoogleMaps3
 21+ *
 22+ * @author Jeroen De Dauw
 23+ */
 24+final class MapsGoogleMaps3DispMap extends MapsBaseMap {
 25+
 26+ public $serviceName = MapsGoogleMaps3::SERVICE_NAME;
 27+
 28+ /**
 29+ * @see MapsBaseMap::setMapSettings()
 30+ *
 31+ */
 32+ protected function setMapSettings() {
 33+ global $egMapsGoogleMaps3Zoom, $egMapsGoogleMaps3Prefix;
 34+
 35+ $this->elementNamePrefix = $egMapsGoogleMaps3Prefix;
 36+ $this->defaultZoom = $egMapsGoogleMaps3Zoom;
 37+
 38+ $this->spesificParameters = array(
 39+ );
 40+ }
 41+
 42+ /**
 43+ * @see MapsBaseMap::doMapServiceLoad()
 44+ *
 45+ */
 46+ protected function doMapServiceLoad() {
 47+ global $egGoogleMaps3OnThisPage;
 48+
 49+ MapsGoogleMaps3::addGMap3Dependencies($this->output);
 50+ $egGoogleMaps3OnThisPage++;
 51+
 52+ $this->elementNr = $egGoogleMaps3OnThisPage;
 53+ }
 54+
 55+ /**
 56+ * @see MapsBaseMap::addSpecificMapHTML()
 57+ *
 58+ */
 59+ public function addSpecificMapHTML() {
 60+ global $wgJsMimeType;
 61+
 62+ // TODO
 63+ $this->output .=<<<END
 64+
 65+END;
 66+
 67+ }
 68+
 69+}
 70+
Index: trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3.php
@@ -0,0 +1,73 @@
 2+<?php
 3+
 4+/**
 5+ * This groupe contains all Google Maps v3 related files of the Maps extension.
 6+ *
 7+ * @defgroup MapsGoogleMaps3 Google Maps v3
 8+ * @ingroup Maps
 9+ */
 10+
 11+/**
 12+ * This file holds the general information for the Google Maps v3 service.
 13+ *
 14+ * @file Maps_GoogleMaps3.php
 15+ * @ingroup MapsGoogleMaps3
 16+ *
 17+ * @author Jeroen De Dauw
 18+ */
 19+
 20+if( !defined( 'MEDIAWIKI' ) ) {
 21+ die( 'Not an entry point.' );
 22+}
 23+
 24+$egMapsServices['googlemaps3'] = array(
 25+ 'pf' => array(
 26+ 'display_point' => array('class' => 'MapsGoogleMaps3DispPoint', 'file' => 'GoogleMaps/Maps_GoogleMaps3DispPoint.php', 'local' => true),
 27+ 'display_map' => array('class' => 'MapsGoogleMaps3DispMap', 'file' => 'GoogleMaps/Maps_GoogleMaps3DispMap.php', 'local' => true),
 28+ ),
 29+ 'classes' => array(
 30+ array('class' => 'MapsGoogleMaps3', 'file' => 'GoogleMaps/Maps_GoogleMaps3.php', 'local' => true)
 31+ ),
 32+ 'aliases' => array('google3', 'googlemap3', 'gmap3', 'gmaps3'),
 33+ );
 34+
 35+/**
 36+ * Class for Google Maps v3 initialization.
 37+ *
 38+ * @ingroup MapsGoogleMaps3
 39+ *
 40+ * @author Jeroen De Dauw
 41+ */
 42+class MapsGoogleMaps {
 43+
 44+ const SERVICE_NAME = 'googlemaps3';
 45+
 46+ public static function initialize() {
 47+ self::initializeParams();
 48+ }
 49+
 50+ private static function initializeParams() {
 51+ global $egMapsServices;
 52+
 53+ $egMapsServices[self::SERVICE_NAME]['parameters'] = array(
 54+ );
 55+ }
 56+
 57+ /**
 58+ * Add references to the Google Maps API v3 and required JS file to the provided output
 59+ *
 60+ * @param string $output
 61+ */
 62+ public static function addGMap3Dependencies(&$output) {
 63+ global $wgJsMimeType, $wgLang;
 64+ global $egMapsScriptPath, $egGoogleMaps3OnThisPage, $egMapsStyleVersion;
 65+
 66+ if (empty($egGoogleMaps3OnThisPage)) {
 67+ $egGoogleMaps3OnThisPage = 0;
 68+
 69+ $output .= "<script type='$wgJsMimeType' src='http://maps.google.com/maps/api/js?sensor=false&language={$wgLang->getCode()}'><script type='$wgJsMimeType' src='$egMapsScriptPath/GoogleMaps3/GoogleMap3Functions.js?$egMapsStyleVersion'></script>";
 70+ }
 71+ }
 72+
 73+}
 74+
\ No newline at end of file
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php
@@ -13,6 +13,13 @@
1414 die( 'Not an entry point.' );
1515 }
1616
 17+/**
 18+ * Class for handling the display_map parser functions with Google Maps.
 19+ *
 20+ * @ingroup MapsGoogleMaps
 21+ *
 22+ * @author Jeroen De Dauw
 23+ */
1724 final class MapsGoogleMapsDispMap extends MapsBaseMap {
1825
1926 public $serviceName = MapsGoogleMaps::SERVICE_NAME;
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php
@@ -16,6 +16,8 @@
1717 /**
1818 * Class for handling the display_point(s) parser functions with Google Maps.
1919 *
 20+ * @ingroup MapsGoogleMaps
 21+ *
2022 * @author Jeroen De Dauw
2123 */
2224 final class MapsGoogleMapsDispPoint extends MapsBasePointMap {
Index: trunk/extensions/Maps/GoogleMaps/GoogleMapFunctions.js
@@ -1,5 +1,5 @@
22 /**
3 - * Javascript functions for Google Maps functionallity in Maps and it's extensions.
 3+ * Javascript functions for Google Maps functionallity in Maps.
44 *
55 * @file GoogleMapFunctions.js
66 * @ingroup MapsGoogleMaps

Comments

#Comment by Platonides (talk | contribs)   20:48, 20 January 2010

You open two <script> tags and close only one. & should be escaped as & in the html output (that includes the src attribute).

#Comment by Platonides (talk | contribs)   20:49, 20 January 2010

& should be escaped as & a m p ;

#Comment by Jeroen De Dauw (talk | contribs)   00:02, 21 January 2010

Thanks, will fix.

Status & tagging log