00001 <?php
00002
00012 if ( !defined( 'MEDIAWIKI' ) ) {
00013 die( 'Not an entry point.' );
00014 }
00015
00016
00017
00018 final class SMOSMFormInput extends SMFormInput {
00019
00020 public $serviceName = MapsOSM::SERVICE_NAME;
00021
00026 protected function setMapSettings() {
00027 global $egMapsOSMZoom, $egMapsOSMPrefix;
00028
00029 $this->elementNamePrefix = $egMapsOSMPrefix;
00030
00031 $this->earthZoom = 1;
00032
00033 $this->defaultZoom = $egMapsOSMZoom;
00034 }
00035
00040 protected function addFormDependencies() {
00041 global $wgJsMimeType;
00042 global $smgScriptPath, $smgOSMFormsOnThisPage, $smgStyleVersion, $egMapsJsExt;
00043
00044 MapsOSM::addOSMDependencies( $this->output );
00045
00046 if ( empty( $smgOSMFormsOnThisPage ) ) {
00047 $smgOSMFormsOnThisPage = 0;
00048 $this->output .= "<script type='$wgJsMimeType' src='$smgScriptPath/OpenStreetMap/SM_OSMFunctions{$egMapsJsExt}?$smgStyleVersion'></script>";
00049 }
00050 }
00051
00056 protected function doMapServiceLoad() {
00057 global $egOSMMapsOnThisPage, $smgOSMFormsOnThisPage;
00058
00059 self::addFormDependencies();
00060
00061 $egOSMMapsOnThisPage++;
00062 $smgOSMFormsOnThisPage++;
00063
00064 $this->elementNr = $egOSMMapsOnThisPage;
00065 }
00066
00071 protected function addSpecificMapHTML( Parser $parser ) {
00072 global $wgJsMimeType;
00073
00074 $this->output .= <<<EOT
00075 <script type='$wgJsMimeType'>
00076 makeOSMFormInput(
00077 '$this->mapName',
00078 '$this->coordsFieldName',
00079 {
00080 mode: 'osm-wm',
00081 layer: 'osm-like',
00082 locale: '$this->lang',
00083 lat: $this->centreLat,
00084 lon: $this->centreLon,
00085 zoom: $this->zoom,
00086 width: $this->width,
00087 height: $this->height,
00088 controls: [$this->controls],
00089 }
00090 );
00091
00092
00093 </script>
00094
00095 <div id='$this->mapName' class='map' style='width:{$this->width}px; height:{$this->height}px;'>
00096 <script type='$wgJsMimeType'>slippymaps['$this->mapName'].init();</script>
00097 </div>
00098 EOT;
00099 }
00100
00105 protected function manageGeocoding() {
00106 $this->enableGeocoding = false;
00107 }
00108
00109 }