00001 <?php
00002
00013 class SMGoogleMapsFormInput extends SMFormInput {
00014
00020 protected function getEarthZoom() {
00021 return 1;
00022 }
00023
00029 protected function getShowAddressFunction() {
00030 global $egGoogleMapsKey;
00031 return $egGoogleMapsKey == '' ? false : 'showGAddress';
00032 }
00033
00037 protected function addFormDependencies() {
00038 global $wgOut;
00039 global $smgScriptPath, $smgStyleVersion;
00040
00041 $this->service->addDependency( Html::linkedScript( "$smgScriptPath/includes/services/GoogleMaps/SM_GoogleMapsForms.js?$smgStyleVersion" ) );
00042 $this->service->addDependencies( $wgOut );
00043 }
00044
00048 public function addSpecificMapHTML() {
00049 $mapName = $this->service->getMapId( false );
00050
00051
00052
00053 if ( in_string( 'overlays', $this->controls ) ) {
00054 $this->controls = str_replace( array( ",'overlays'", "'overlays'," ), '', $this->controls );
00055 }
00056
00057 $this->output .= Html::element(
00058 'div',
00059 array(
00060 'id' => $mapName,
00061 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;",
00062 ),
00063 wfMsg( 'maps-loading-map' )
00064 );
00065
00066 MapsMapper::addInlineScript( $this->service, <<<EOT
00067 makeGoogleMapFormInput(
00068 "$mapName",
00069 "$this->coordsFieldName",
00070 {
00071 lat: $this->centreLat,
00072 lon: $this->centreLon,
00073 zoom: $this->zoom,
00074 type: $this->type,
00075 types: [$this->types],
00076 controls: [$this->controls],
00077 scrollWheelZoom: $this->autozoom,
00078 kml: [$this->kml]
00079 },
00080 {$this->markerCoords['lat']},
00081 {$this->markerCoords['lon']}
00082 );
00083 EOT
00084 );
00085 }
00086
00087 }