Advertisement
vedmaka

smaps_1.0.5.patch

Mar 27th, 2012
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 18.65 KB | None | 0 0
  1. Index: includes/services/Yandex/ext.sm.yandexmapsinput.js
  2. ===================================================================
  3. --- includes/services/Yandex/ext.sm.yandexmapsinput.js  (revision 0)
  4. +++ includes/services/Yandex/ext.sm.yandexmapsinput.js  (working copy)
  5. @@ -0,0 +1,33 @@
  6. +/**
  7. + * JavasSript for the Yandex Map form input in the Semantic Maps extension.
  8. + * @see http://www.mediawiki.org/wiki/Extension:Semantic_Maps
  9. + *
  10. + * @since 1.0
  11. + * @ingroup SemanticMaps
  12. + *
  13. + * @licence GNU GPL v3
  14. + * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
  15. + */
  16. +
  17. +jQuery(document).ready(function() {
  18. +   if ( true ) { // TODO
  19. +       for ( i in window.mwmaps.yandex_forminputs ) {
  20. +           if ( window.mwmaps.yandex_forminputs[i].ismulti ) {
  21. +               jQuery( '#' + i + '_forminput' ).ymapsmultiinput( i, window.mwmaps.yandex_forminputs[i] );
  22. +           }
  23. +           else {
  24. +               jQuery( '#' + i + '_forminput' ).yandexmapsinput( i, window.mwmaps.yandex_forminputs[i] );
  25. +           }
  26. +       }
  27. +   }
  28. +   else {
  29. +       alert( mediaWiki.msg( 'maps-googlemaps3-incompatbrowser' ) );
  30. +      
  31. +       for ( i in window.mwmaps.yandex_forminputs ) {
  32. +           jQuery( '#' + i + '_forminput' )
  33. +               .html( $( '<input />' )
  34. +                   .attr( { 'name': i, 'value': semanticMaps.buildInputValue( window.mwmaps.yandex_forminputs[i].locations ) } )
  35. +               );
  36. +       }
  37. +   }  
  38. +});
  39. Index: includes/services/Yandex/jquery.yandexmapsinput.js
  40. ===================================================================
  41. --- includes/services/Yandex/jquery.yandexmapsinput.js  (revision 0)
  42. +++ includes/services/Yandex/jquery.yandexmapsinput.js  (working copy)
  43. @@ -0,0 +1,76 @@
  44. +/**
  45. + * JavasSript for the Yandex Map form input of the Semantic Maps extension.
  46. + * @see http://www.mediawiki.org/wiki/Extension:Semantic_Maps
  47. + *
  48. + * @since 1.0
  49. + * @ingroup SemanticMaps
  50. + *
  51. + * @licence GNU GPL v3
  52. + * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
  53. + */
  54. +
  55. +(function( $ ){ $.fn.yandexmapsinput = function( mapDivId, options ) {
  56. +
  57. +   var self = this;
  58. +   var geocoder = false;
  59. +  
  60. +   /**
  61. +    * Creates and places a new marker on the map at the provided
  62. +    * coordinate set and the pans to it.
  63. +    * @param {Object} coordinate
  64. +    */
  65. +   this.showCoordinate = function( coordinate ) {
  66. +       this.mapDiv.removeMarkers();
  67. +        var markerData = {
  68. +            title: '',
  69. +            icon: '',
  70. +            text: coordinate.lat + ',' + coordinate.lon,
  71. +            point: new YMaps.GeoPoint(coordinate.lon,coordinate.lat)
  72. +        };
  73. +       //coordinate.text = coord.dms( coordinate.lat, coordinate.lon );
  74. +       this.mapDiv.addMarker( markerData );
  75. +       this.mapDiv.map.panTo( new YMaps.GeoPoint(coordinate.lon,coordinate.lat) );
  76. +   };
  77. +  
  78. +   /**
  79. +    * Calls this.showCoordinate with the provided latLng and updates the input field.
  80. +    * @param {google.maps.LatLng} latLng
  81. +    */
  82. +   this.showLatLng = function( latLng ) {
  83. +       var location = { lat: latLng.getLat(), lon: latLng.getLng() };
  84. +       this.showCoordinate( location );
  85. +       this.updateInput( [ location ] );      
  86. +   };
  87. +  
  88. +   this.setupGeocoder = function() {
  89. +       if ( geocoder === false ) {
  90. +           geocoder = new YMaps.Geocoder();
  91. +       }
  92. +   };
  93. +
  94. +    this.geocodeAddress = function ( address ) {
  95. +
  96. +        var gc = new YMaps.Geocoder( address );
  97. +        YMaps.Events.observe(gc, gc.Events.Load, function () {
  98. +            if (this.length()) {
  99. +                self.showLatLng( this.get(0).getGeoPoint() );
  100. +            }else{
  101. +                // TODO: i18n
  102. +                alert( "Geocode was not successful!" );
  103. +            }
  104. +        });
  105. +    };
  106. +  
  107. +   this.mapforminput( mapDivId, options );
  108. +  
  109. +   this.mapDiv.yandex( options );
  110. +
  111. +    YMaps.Events.observe(this.mapDiv.map, this.mapDiv.map.Events.Click, function (map, mEvent) {
  112. +
  113. +        self.showLatLng( mEvent.getGeoPoint() );
  114. +
  115. +    });
  116. +  
  117. +   return this;
  118. +  
  119. +}; })( jQuery );
  120. \ No newline at end of file
  121. Index: includes/services/Yandex/jquery.ymapsmultiinput.js
  122. ===================================================================
  123. --- includes/services/Yandex/jquery.ymapsmultiinput.js  (revision 0)
  124. +++ includes/services/Yandex/jquery.ymapsmultiinput.js  (working copy)
  125. @@ -0,0 +1,317 @@
  126. +/**
  127. + * JavasSript for the Yandex Maps form input of the Semantic Maps extension.
  128. + * @see http://www.mediawiki.org/wiki/Extension:Semantic_Maps
  129. + *
  130. + * @since 1.0
  131. + * @ingroup SemanticMaps
  132. + *
  133. + * @licence GNU GPL v3
  134. + * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
  135. + */
  136. +
  137. +(function( $, mw ){ $.fn.gmapsmultiinput = function( mapDivId, options ) {
  138. +   var MAPFILES_URL = "http://maps.gstatic.com/intl/en_us/mapfiles/";
  139. +  
  140. +   var clickIcon = new google.maps.MarkerImage(
  141. +       MAPFILES_URL + 'dd-start.png',
  142. +       new google.maps.Size(20, 34),
  143. +       new google.maps.Point(0, 0),
  144. +       new google.maps.Point(10, 34)
  145. +   );
  146. +  
  147. +   var clickMarker = null;
  148. +  
  149. +   var geocoder = new google.maps.Geocoder();
  150. +  
  151. +   this.attr( { 'class': "ui-widget" } ).css( { 'width': 'auto' } );
  152. +  
  153. +   this.html(
  154. +       $( '<div />' ).css( {
  155. +           'display': 'none'
  156. +       } ).append( $( '<input />' ).attr( { 'type': 'text', 'name': options.inputname, 'id': mapDivId + '_values' } ) )
  157. +   );
  158. +  
  159. +   updateInputValue( semanticMaps.buildInputValue( options.locations ) );
  160. +  
  161. +   var table = $( '<table />' ).attr( { 'class' : 'mapinput ui-widget ui-widget-content' } );
  162. +   this.append( table );
  163. +  
  164. +   var mapDiv = $( '<div />' )
  165. +       .attr( {
  166. +           'id': mapDivId,
  167. +           'class': 'ui-widget ui-widget-content'
  168. +       } )
  169. +       .css( {
  170. +           'width': options.width,
  171. +           'height': options.height
  172. +       } );
  173. +   this.append( mapDiv );
  174. +   mapDiv.googlemaps( options );
  175. +  
  176. +   google.maps.event.addListener( mapDiv.map, 'click', onClickCallback );
  177. +  
  178. +   function onClickCallback() {
  179. +       // TODO
  180. +   }
  181. +  
  182. +   table.append(
  183. +       '<thead><tr class="ui-widget-header "><th colspan="2">' + mw.msg( 'semanticmaps-forminput-locations' ) + '</th></tr></thead><tbody>'
  184. +   );
  185. +  
  186. +   var rowNr = options.locations.length;
  187. +  
  188. +   for ( i in options.locations ) {
  189. +       appendTableRow( i, options.locations[i].lat, options.locations[i].lon );
  190. +   }
  191. +  
  192. +   table.append(
  193. +       '<tr id="' + mapDivId + '_addrow"><td width="300px">' +
  194. +           '<input type="text" class="text ui-widget-content ui-corner-all" width="95%" id="' + mapDivId + '_addfield" />' +
  195. +       '</td><td>' +
  196. +           '<button id="' + mapDivId + '_addbutton" mapid="' + mapDivId + '">' + mw.msg( 'semanticmaps-forminput-add' ) + '</button>' +
  197. +       '</td></tr></tbody>'
  198. +   );
  199. +  
  200. +   $( "#" + mapDivId + '_addbutton' ).button().click( onAddButtonClick );
  201. +  
  202. +   function onAddButtonClick() {
  203. +       var location = $( '#' + mapDivId + '_addfield' ).attr( 'value' );
  204. +       submitGeocodeQuery( location );
  205. +       return false;      
  206. +   }
  207. +  
  208. +   function submitGeocodeQuery( query ) {
  209. +       if ( /\s*^\-?\d+(\.\d+)?\s*\,\s*\-?\d+(\.\d+)?\s*$/.test( query ) ) {
  210. +           var latlng = parseLatLng(query);
  211. +          
  212. +           if (latlng == null) {
  213. +               $( '#' + mapDivId + '_addfield' ).attr( 'value', '' );
  214. +           } else {
  215. +               geocode({ 'latLng': latlng });
  216. +           }
  217. +       } else {
  218. +           geocode({ 'address': query });
  219. +       }
  220. +   }
  221. +  
  222. +   function parseLatLng(value) {
  223. +       value.replace('/\s//g');
  224. +       var coords = value.split(',');
  225. +       var lat = parseFloat(coords[0]);
  226. +       var lng = parseFloat(coords[1]);
  227. +       if (isNaN(lat) || isNaN(lng)) {
  228. +           return null;
  229. +       } else {
  230. +           return new google.maps.LatLng(lat, lng);
  231. +       }
  232. +   }
  233. +  
  234. +   function geocode(request) {
  235. +       var hash = '';
  236. +      
  237. +       if (request.latLng) {
  238. +       clickMarker = new google.maps.Marker({
  239. +           'position': request.latLng,
  240. +           'map': map,
  241. +           'title': request.latLng.toString(),
  242. +           'clickable': false,
  243. +           'icon': clickIcon,
  244. +           'shadow': shadow
  245. +       });
  246. +           hash = 'q=' + request.latLng.toUrlValue(6);
  247. +       } else {
  248. +           hash = 'q=' + request.address;
  249. +       }
  250. +      
  251. +       var vpbias = false;
  252. +       var country = '';
  253. +       var language = '';
  254. +      
  255. +       if (vpbias) {
  256. +           hash += '&vpcenter=' + map.getCenter().toUrlValue(6);
  257. +           hash += '&vpzoom=' + map.getZoom();
  258. +           request.bounds = map.getBounds();
  259. +       }
  260. +      
  261. +       if (country) {
  262. +           hash += '&country=' + country;
  263. +           request.country = country;
  264. +       }
  265. +      
  266. +       if (language) {
  267. +           hash += '&language=' + language;
  268. +           request.language = language;
  269. +       }
  270. +
  271. +       hashFragment = '#' + escape(hash);
  272. +       window.location.hash = escape(hash);
  273. +       geocoder.geocode(request, showResults);
  274. +   }
  275. +  
  276. +   function showResults(results, status) {
  277. +       var reverse = (clickMarker != null); // TODO
  278. +      
  279. +       if (! results) {
  280. +           // TODO
  281. +           alert("Geocoder did not return a valid response");
  282. +       } else {
  283. +           //document.getElementById("statusValue").innerHTML = status;
  284. +
  285. +           if (status == google.maps.GeocoderStatus.OK) {
  286. +               //document.getElementById("matchCount").innerHTML = results.length;
  287. +               var marker = new google.maps.Marker( {
  288. +                   map: mapDiv.map,
  289. +                   position: results[0].geometry.location,
  290. +                   title: results[0].geometry.location.toString()
  291. +               } );
  292. +               addLocationRow( results[0].geometry.location.lat(), results[0].geometry.location.lng() );              
  293. +               //plotMatchesOnMap(results, reverse);
  294. +           } else {
  295. +               if ( !reverse) {
  296. +                   mapDiv.map.setCenter(new google.maps.LatLng(0.0, 0.0));
  297. +                   mapDiv.map.setZoom(1); // TODO
  298. +               }
  299. +           }
  300. +       }
  301. +   }
  302. +  
  303. +   function plotMatchesOnMap(results, reverse) {
  304. +       markers = new Array(results.length);
  305. +       var resultsListHtml = "";
  306. +      
  307. +       var openInfoWindow = function(resultNum, result, marker) {
  308. +           return function() {
  309. +               if (selected != null) {
  310. +                   document.getElementById('p' + selected).style.backgroundColor = "white";
  311. +                   clearBoundsOverlays();
  312. +               }
  313. +              
  314. +               map.fitBounds(result.geometry.viewport);
  315. +               infowindow.setContent(getAddressComponentsHtml(result.address_components));
  316. +               infowindow.open(map, marker);
  317. +              
  318. +               if (result.geometry.bounds) {
  319. +                   boundsOverlay = new google.maps.Rectangle({
  320. +                       'bounds': result.geometry.bounds,
  321. +                       'strokeColor': '#ff0000',
  322. +                       'strokeOpacity': 1.0,
  323. +                       'strokeWeight': 2.0,
  324. +                       'fillOpacity': 0.0
  325. +                   });
  326. +                   boundsOverlay.setMap(map);
  327. +                   google.maps.event.addListener(boundsOverlay, 'click', onClickCallback);
  328. +                   document.getElementById('boundsLegend').style.display = 'block';
  329. +               } else {
  330. +                   boundsOverlay = null;
  331. +               }
  332. +              
  333. +               viewportOverlay = new google.maps.Rectangle({
  334. +                       'bounds': result.geometry.viewport,
  335. +                       'strokeColor': '#0000ff',
  336. +                       'strokeOpacity': 1.0,
  337. +                       'strokeWeight': 2.0,
  338. +                       'fillOpacity': 0.0
  339. +                   });
  340. +               viewportOverlay.setMap(map);
  341. +               google.maps.event.addListener(viewportOverlay, 'click', onClickCallback);
  342. +               document.getElementById('viewportLegend').style.display = 'block';
  343. +
  344. +               document.getElementById('p' + resultNum).style.backgroundColor = "#eeeeff";
  345. +               document.getElementById('matches').scrollTop =
  346. +                   document.getElementById('p' + resultNum).offsetTop -
  347. +                   document.getElementById('matches').offsetTop;
  348. +               selected = resultNum;
  349. +           }
  350. +       }
  351. +          
  352. +       for (var i = 0; i < results.length; i++) {
  353. +           var icon = new google.maps.MarkerImage(
  354. +               getMarkerImageUrl(i),
  355. +               new google.maps.Size(20, 34),
  356. +               new google.maps.Point(0, 0),
  357. +               new google.maps.Point(10, 34)
  358. +           );
  359. +          
  360. +           markers[i] = new google.maps.Marker({
  361. +               'position': results[i].geometry.location,
  362. +               'map': map,
  363. +               'icon': icon,
  364. +               'shadow': shadow
  365. +           });
  366. +
  367. +           google.maps.event.addListener(markers[i], 'click', openInfoWindow(i, results[i], markers[i]));
  368. +          
  369. +           resultsListHtml += getResultsListItem(i, getResultDescription(results[i]));
  370. +       }
  371. +      
  372. +       document.getElementById("matches").innerHTML = resultsListHtml;
  373. +       document.getElementById("p0").style.border = "none";
  374. +       document.getElementById("matches").style.display = "block";
  375. +
  376. +       if (reverse){
  377. +           // make a smooth movement to the clicked position
  378. +           map.panTo(clickMarker.getPosition());
  379. +           google.maps.event.addListenerOnce(map, 'idle', function(){
  380. +               selectMarker(0);
  381. +           });
  382. +       }
  383. +       else {
  384. +           zoomToViewports(results);
  385. +           selectMarker(0);
  386. +       }
  387. +   }
  388. +  
  389. +   function getMarkerImageUrl(resultNum) {
  390. +       return MAPFILES_URL + "marker" + String.fromCharCode(65 + resultNum) + ".png";
  391. +   }
  392. +  
  393. +   function addLocationRow( lat, lon ) {
  394. +       var addRow = $( '#' + mapDivId + '_addrow' );
  395. +      
  396. +       addRow.remove();
  397. +       appendTableRow( rowNr, lat, lon ); // TODO
  398. +       table.append( addRow );
  399. +       $( '#' + mapDivId + '_addfield' ).attr( 'value', '' );
  400. +       $( "#" + mapDivId + '_addbutton' ).button().click( onAddButtonClick );
  401. +       rowNr++;
  402. +      
  403. +       updateInput();
  404. +   }
  405. +  
  406. +   function onRemoveButtonClick() {
  407. +       $( '#' + mapDivId + '_row_' + $( this ).attr( 'rowid' ) ).remove();
  408. +       updateInput();
  409. +       return false;      
  410. +   }
  411. +  
  412. +   function appendTableRow( i, lat, lon ) {
  413. +       table.append(
  414. +           '<tr id="' + mapDivId + '_row_' + i + '"><td>' +
  415. +               coord.dms( lat, lon ) +
  416. +           '</td><td>' +
  417. +               '<button class="forminput-remove" rowid="' + i + '" id="' + mapDivId + '_addbutton_' + i + '">' +
  418. +                   mw.msg( 'semanticmaps-forminput-remove' ) +
  419. +               '</button>' +
  420. +           '</td></tr>'
  421. +       );
  422. +      
  423. +       $( "#" + mapDivId + '_addbutton_' + i ).button().click( onRemoveButtonClick );
  424. +   }
  425. +  
  426. +
  427. +  
  428. +   function updateInput() {
  429. +       var locations = [];
  430. +      
  431. +       //$( '' ).each();
  432. +      
  433. +       updateInputValue( semanticMaps.buildInputValue( locations ) );
  434. +   }
  435. +  
  436. +   function updateInputValue( value ) {
  437. +       $( '#' + mapDivId + '_values' ).text( value );
  438. +   }
  439. +  
  440. +   return this;
  441. +  
  442. +}; })( jQuery, mediaWiki );
  443. \ No newline at end of file
  444. Index: includes/services/Yandex/SM_YandexMaps.php
  445. ===================================================================
  446. --- includes/services/Yandex/SM_YandexMaps.php  (revision 0)
  447. +++ includes/services/Yandex/SM_YandexMaps.php  (working copy)
  448. @@ -0,0 +1,77 @@
  449. +<?php
  450. +
  451. +/**
  452. + * This groupe contains all Yandex Maps related files of the Semantic Maps extension.
  453. + *
  454. + * @defgroup SMYandexMaps Yandex Maps
  455. + * @ingroup SMYandexMaps
  456. + */
  457. +
  458. +/**
  459. + * This file holds the general information for the Yandex Maps service.
  460. + *
  461. + *
  462. + *
  463. + * @file SM_YandexMaps.php
  464. + * @ingroup SMYandexMaps
  465. + *
  466. + * @licence GNU GPL v3
  467. + * @author Vedmaka < god.vedmaka@gmail.com >
  468. + */
  469. +
  470. +if ( !defined( 'MEDIAWIKI' ) ) {
  471. +   die( 'Not an entry point.' );
  472. +}
  473. +
  474. +$moduleTemplate = array(
  475. +   'localBasePath' => dirname( __FILE__ ),
  476. +   'remoteBasePath' => $smgScriptPath .  '/includes/services/Yandex',
  477. +   'group' => 'ext.semanticmaps',
  478. +);
  479. +
  480. +$wgResourceModules['ext.sm.fi.yandex'] = $moduleTemplate + array(
  481. +   'dependencies' => array( 'ext.maps.yandex', 'ext.sm.forminputs' ),
  482. +   'scripts' => array(
  483. +       'ext.sm.yandexmapsinput.js'
  484. +   ),
  485. +);
  486. +
  487. +$wgResourceModules['ext.sm.fi.yandex.single'] = $moduleTemplate + array(
  488. +   'dependencies' => array( 'ext.sm.fi.yandex' ),
  489. +   'scripts' => array(
  490. +       'jquery.yandexmapsinput.js',
  491. +   ),
  492. +   'messages' => array(
  493. +   )
  494. +);
  495. +/*
  496. +$wgResourceModules['ext.sm.fi.googlemaps3.multi'] = $moduleTemplate + array(
  497. +   'dependencies' => array( 'ext.sm.fi.googlemaps3', 'jquery.ui.button', 'jquery.ui.dialog' ),
  498. +   'localBasePath' => dirname( __FILE__ ),
  499. +   'scripts' => array(
  500. +       'jquery.gmapsmultiinput.js',
  501. +   ),
  502. +   'messages' => array(
  503. +       'semanticmaps-forminput-remove',
  504. +       'semanticmaps-forminput-add',
  505. +       'semanticmaps-forminput-locations'
  506. +   )
  507. +);
  508. +*/
  509. +unset( $moduleTemplate );
  510. +
  511. +$wgHooks['MappingServiceLoad'][] = 'smfInitYandexMaps';
  512. +
  513. +function smfInitYandexMaps() {
  514. +   global $wgAutoloadClasses, $sfgFormPrinter;
  515. +  
  516. +   $wgAutoloadClasses['SMYandexMapsFormInput'] = dirname( __FILE__ ) . '/SM_YandexMapsFormInput.php';
  517. +   //$wgAutoloadClasses['SMGoogleMaps3MultiInput'] = dirname( __FILE__ ) . '/SM_GoogleMaps3MultiInput.php';
  518. +  
  519. +   MapsMappingServices::registerServiceFeature( 'yandex', 'qp', 'SMMapPrinter' );
  520. +   MapsMappingServices::registerServiceFeature( 'yandex', 'fi', 'SMYandexMapsFormInput' );
  521. +  
  522. +   //$sfgFormPrinter->setInputTypeHook( 'googlemapsmulti', array( 'SMGoogleMaps3MultiInput', 'onInputRequest' ), array() );
  523. +  
  524. +   return true;
  525. +}
  526. Index: includes/services/Yandex/SM_YandexMapsFormInput.php
  527. ===================================================================
  528. --- includes/services/Yandex/SM_YandexMapsFormInput.php (revision 0)
  529. +++ includes/services/Yandex/SM_YandexMapsFormInput.php (working copy)
  530. @@ -0,0 +1,26 @@
  531. +<?php
  532. +
  533. +/**
  534. + * Yandex Maps form input class.
  535. + *
  536. + * @since 1.0
  537. + * @file SM_YandexMapsFormInput.php
  538. + * @ingroup SemanticMaps
  539. + *
  540. + * @licence GNU GPL v3
  541. + * @author Vedmaka < god.vedmaka@gmail.com >
  542. + */
  543. +class SMYandexMapsFormInput extends SMFormInput {
  544. +  
  545. +   /**
  546. +    * @see SMFormInput::getResourceModules
  547. +    *
  548. +    * @since 1.0
  549. +    *
  550. +    * @return array of string
  551. +    */
  552. +   protected function getResourceModules() {
  553. +       return array_merge( parent::getResourceModules(), array( 'ext.sm.fi.yandex.single' ) );
  554. +   }  
  555. +  
  556. +}
  557. Index: includes/services/Yandex/SM_YandexMapsMultiInput.php
  558. ===================================================================
  559. --- includes/services/Yandex/SM_YandexMapsMultiInput.php    (revision 0)
  560. +++ includes/services/Yandex/SM_YandexMapsMultiInput.php    (working copy)
  561. @@ -0,0 +1,47 @@
  562. +<?php
  563. +
  564. +/**
  565. + * Yandex Maps form input class for multiple locations.
  566. + *
  567. + * @since 1.0
  568. + * @file SM_YandexMapsMultiInput.php
  569. + * @ingroup SemanticMaps
  570. + *
  571. + * @licence GNU GPL v3
  572. + * @author Vedmaka < god.vedmaka@gmail.com >
  573. + */
  574. +class SMYandexMapsMultiInput extends SMFormInput {
  575. +  
  576. +   /**
  577. +    * @see SMFormInput::getResourceModules
  578. +    *
  579. +    * @since 1.0
  580. +    *
  581. +    * @return array of string
  582. +    */
  583. +   protected function getResourceModules() {
  584. +       return array_merge( parent::getResourceModules(), array( 'ext.sm.fi.yandex.multi' ) );
  585. +   }
  586. +  
  587. +   public static function onInputRequest( $coordinates, $input_name, $is_mandatory, $is_disabled, array $field_args ) {
  588. +       $formInput = new self( MapsMappingServices::getServiceInstance( 'yandex' ) );
  589. +       return $formInput->getInputOutput( $coordinates, $input_name, $is_mandatory, $is_disabled, $field_args );      
  590. +   }
  591. +  
  592. +   /**
  593. +    * Returns a PHP object to encode to JSON with the map data.
  594. +    *
  595. +    * @since 1.0
  596. +    *
  597. +    * @param array $params
  598. +    * @param Parser $parser
  599. +    *
  600. +    * @return mixed
  601. +    */
  602. +   protected function getJSONObject( array $params, Parser $parser ) {
  603. +       $params['ismulti'] = true;
  604. +      
  605. +       return $params;
  606. +   }  
  607. +  
  608. +}
  609. Index: SemanticMaps.php
  610. ===================================================================
  611. --- SemanticMaps.php    (revision 114523)
  612. +++ SemanticMaps.php    (working copy)
  613. @@ -88,7 +88,9 @@
  614.     # OpenLayers API
  615.     include_once $smgDir . 'includes/services/OpenLayers/SM_OpenLayers.php';
  616.     # Yahoo! Maps API
  617. -   include_once $smgDir . 'includes/services/YahooMaps/SM_YahooMaps.php'; 
  618. +   include_once $smgDir . 'includes/services/YahooMaps/SM_YahooMaps.php';
  619. +    # Yandex Maps API
  620. +   include_once $smgDir . 'includes/services/Yandex/SM_YandexMaps.php';
  621.  
  622.  $wgExtensionMessagesFiles['SemanticMaps'] = $smgDir . 'SemanticMaps.i18n.php';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement