Index: tags/extensions/SemanticMaps/REL_0_3_2/YahooMaps/SM_YahooMaps.php |
— | — | @@ -0,0 +1,95 @@ |
| 2 | +<?php
|
| 3 | +/**
|
| 4 | + * A query printer for maps using the Yahoo Maps API
|
| 5 | + *
|
| 6 | + * @file SM_YahooMaps.php
|
| 7 | + * @ingroup SemanticMaps
|
| 8 | + *
|
| 9 | + * @author Jeroen De Dauw
|
| 10 | + */
|
| 11 | +
|
| 12 | +if( !defined( 'MEDIAWIKI' ) ) {
|
| 13 | + die( 'Not an entry point.' );
|
| 14 | +}
|
| 15 | +
|
| 16 | +final class SMYahooMaps extends SMMapPrinter {
|
| 17 | +
|
| 18 | + public $serviceName = MapsYahooMaps::SERVICE_NAME;
|
| 19 | +
|
| 20 | + public function getName() {
|
| 21 | + wfLoadExtensionMessages('SemanticMaps');
|
| 22 | + return wfMsg('sm_yahoomaps_printername');
|
| 23 | + }
|
| 24 | +
|
| 25 | + /**
|
| 26 | + * @see SMMapPrinter::setQueryPrinterSettings()
|
| 27 | + *
|
| 28 | + */
|
| 29 | + protected function setQueryPrinterSettings() {
|
| 30 | + global $egMapsYahooMapsZoom, $egMapsYahooMapsPrefix;
|
| 31 | +
|
| 32 | + $this->elementNamePrefix = $egMapsYahooMapsPrefix;
|
| 33 | +
|
| 34 | + $this->defaultZoom = $egMapsYahooMapsZoom;
|
| 35 | +
|
| 36 | + $this->defaultParams = MapsYahooMapsUtils::getDefaultParams();
|
| 37 | + }
|
| 38 | +
|
| 39 | + /**
|
| 40 | + * @see SMMapPrinter::doMapServiceLoad()
|
| 41 | + *
|
| 42 | + */
|
| 43 | + protected function doMapServiceLoad() {
|
| 44 | + global $egYahooMapsOnThisPage;
|
| 45 | +
|
| 46 | + MapsYahooMapsUtils::addYMapDependencies($this->output);
|
| 47 | + $egYahooMapsOnThisPage++;
|
| 48 | +
|
| 49 | + $this->elementNr = $egYahooMapsOnThisPage;
|
| 50 | + }
|
| 51 | +
|
| 52 | + /**
|
| 53 | + * @see SMMapPrinter::addSpecificMapHTML()
|
| 54 | + *
|
| 55 | + */
|
| 56 | + protected function addSpecificMapHTML() {
|
| 57 | + global $wgJsMimeType;
|
| 58 | +
|
| 59 | + $this->type = MapsYahooMapsUtils::getYMapType($this->type, true);
|
| 60 | + $this->controls = MapsYahooMapsUtils::createControlsString($this->controls);
|
| 61 | +
|
| 62 | + MapsUtils::makePxValue($this->width);
|
| 63 | + MapsUtils::makePxValue($this->height);
|
| 64 | +
|
| 65 | + $this->autozoom = MapsYahooMapsUtils::getAutozoomJSValue($this->autozoom);
|
| 66 | +
|
| 67 | + $markerItems = array();
|
| 68 | +
|
| 69 | + foreach ($this->m_locations as $location) {
|
| 70 | + // Create a string containing the marker JS
|
| 71 | + list($lat, $lon, $title, $label, $icon) = $location;
|
| 72 | +
|
| 73 | + $title = str_replace("'", "\'", $title);
|
| 74 | + $label = str_replace("'", "\'", $label);
|
| 75 | +
|
| 76 | + $markerItems[] = "getYMarkerData($lat, $lon, '$title', '$label', '$icon')";
|
| 77 | + }
|
| 78 | +
|
| 79 | + $markersString = implode(',', $markerItems);
|
| 80 | +
|
| 81 | + $this->types = explode(",", $this->types);
|
| 82 | +
|
| 83 | + $typesString = MapsYahooMapsUtils::createTypesString($this->types);
|
| 84 | +
|
| 85 | + $this->output .= "
|
| 86 | + <div id='$this->mapName' style='width: $this->width; height: $this->height;'></div>
|
| 87 | +
|
| 88 | + <script type='$wgJsMimeType'>/*<![CDATA[*/
|
| 89 | + addLoadEvent(
|
| 90 | + initializeYahooMap('$this->mapName', $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$typesString], [$this->controls], $this->autozoom, [$markersString])
|
| 91 | + );
|
| 92 | + /*]]>*/</script>";
|
| 93 | +
|
| 94 | + }
|
| 95 | +
|
| 96 | +} |
\ No newline at end of file |
Index: tags/extensions/SemanticMaps/REL_0_3_2/YahooMaps/SM_YahooMapsFormInput.php |
— | — | @@ -0,0 +1,91 @@ |
| 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 SemanticMaps
|
| 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->defaultParams = MapsYahooMapsUtils::getDefaultParams(); |
| 34 | + $this->defaultZoom = $egMapsYahooMapsZoom; |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * @see MapsMapFeature::doMapServiceLoad() |
| 39 | + * |
| 40 | + */ |
| 41 | + protected function doMapServiceLoad() { |
| 42 | + global $egYahooMapsOnThisPage; |
| 43 | + |
| 44 | + if (empty($egYahooMapsOnThisPage)) { |
| 45 | + $egYahooMapsOnThisPage = 0; |
| 46 | + MapsYahooMapsUtils::addYMapDependencies($this->output); |
| 47 | + } |
| 48 | + $egYahooMapsOnThisPage++; |
| 49 | + |
| 50 | + $this->elementNr = $egYahooMapsOnThisPage; |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * @see MapsMapFeature::addSpecificMapHTML() |
| 55 | + * |
| 56 | + */ |
| 57 | + protected function addSpecificMapHTML() { |
| 58 | + global $wgJsMimeType; |
| 59 | + |
| 60 | + $type = MapsYahooMapsUtils::getYMapType($this->type, true); |
| 61 | + |
| 62 | + $this->autozoom = MapsYahooMapsUtils::getAutozoomJSValue($this->autozoom); |
| 63 | + |
| 64 | + $controlItems = MapsYahooMapsUtils::createControlsString($this->controls); |
| 65 | + |
| 66 | + MapsUtils::makePxValue($this->width); |
| 67 | + MapsUtils::makePxValue($this->height); |
| 68 | + |
| 69 | + $this->types = explode(",", $this->types); |
| 70 | + |
| 71 | + $typesString = MapsYahooMapsUtils::createTypesString($this->types); |
| 72 | + |
| 73 | + $this->output .=" |
| 74 | + <div id='".$this->mapName."' style='width: $this->width; height: $this->height;'></div> |
| 75 | + |
| 76 | + <script type='$wgJsMimeType'>/*<![CDATA[*/ |
| 77 | + addLoadEvent(makeFormInputYahooMap('$this->mapName', '$this->coordsFieldName', $this->centre_lat, $this->centre_lon, $this->zoom, $type, [$typesString], [$controlItems], $this->autozoom, $this->marker_lat, $this->centre_lon)); |
| 78 | + /*]]>*/</script>"; |
| 79 | + }
|
| 80 | +
|
| 81 | + /** |
| 82 | + * @see SMFormInput::manageGeocoding() |
| 83 | + * |
| 84 | + */
|
| 85 | + protected function manageGeocoding() { |
| 86 | + global $egYahooMapsKey; |
| 87 | + $this->enableGeocoding = strlen(trim($egYahooMapsKey)) > 0; |
| 88 | + if ($this->enableGeocoding) MapsYahooMapsUtils::addYMapDependencies($this->output);
|
| 89 | + } |
| 90 | +
|
| 91 | + |
| 92 | +} |
Index: tags/extensions/SemanticMaps/REL_0_3_2/OpenLayers/SM_OpenLayers.php |
— | — | @@ -0,0 +1,88 @@ |
| 2 | +<?php
|
| 3 | +
|
| 4 | +/**
|
| 5 | + * A query printer for maps using the Open Layers API
|
| 6 | + *
|
| 7 | + * @file SM_OpenLayers.php
|
| 8 | + * @ingroup SemanticMaps
|
| 9 | + *
|
| 10 | + * @author Jeroen De Dauw
|
| 11 | + */
|
| 12 | +
|
| 13 | +if( !defined( 'MEDIAWIKI' ) ) {
|
| 14 | + die( 'Not an entry point.' );
|
| 15 | +}
|
| 16 | +
|
| 17 | +final class SMOpenLayers extends SMMapPrinter {
|
| 18 | +
|
| 19 | + public $serviceName = MapsOpenLayers::SERVICE_NAME;
|
| 20 | +
|
| 21 | + public function getName() {
|
| 22 | + wfLoadExtensionMessages('SemanticMaps');
|
| 23 | + return wfMsg('sm_openlayers_printername');
|
| 24 | + }
|
| 25 | +
|
| 26 | + /**
|
| 27 | + * @see SMMapPrinter::setQueryPrinterSettings()
|
| 28 | + *
|
| 29 | + */
|
| 30 | + protected function setQueryPrinterSettings() {
|
| 31 | + global $egMapsOpenLayersZoom, $egMapsOpenLayersPrefix;
|
| 32 | +
|
| 33 | + $this->elementNamePrefix = $egMapsOpenLayersPrefix;
|
| 34 | + $this->defaultZoom = $egMapsOpenLayersZoom;
|
| 35 | +
|
| 36 | + $this->defaultParams = MapsOpenLayersUtils::getDefaultParams();
|
| 37 | + }
|
| 38 | +
|
| 39 | + /**
|
| 40 | + * @see SMMapPrinter::doMapServiceLoad()
|
| 41 | + *
|
| 42 | + */
|
| 43 | + protected function doMapServiceLoad() {
|
| 44 | + global $egOpenLayersOnThisPage;
|
| 45 | +
|
| 46 | + MapsOpenLayersUtils::addOLDependencies($this->output);
|
| 47 | + $egOpenLayersOnThisPage++;
|
| 48 | +
|
| 49 | + $this->elementNr = $egOpenLayersOnThisPage;
|
| 50 | + }
|
| 51 | +
|
| 52 | + /**
|
| 53 | + * @see SMMapPrinter::addSpecificMapHTML()
|
| 54 | + *
|
| 55 | + */
|
| 56 | + protected function addSpecificMapHTML() {
|
| 57 | + global $wgJsMimeType;
|
| 58 | +
|
| 59 | + $controlItems = MapsOpenLayersUtils::createControlsString($this->controls);
|
| 60 | +
|
| 61 | + MapsMapper::enforceArrayValues($this->layers);
|
| 62 | + $layerItems = MapsOpenLayersUtils::createLayersStringAndLoadDependencies($this->output, $this->layers);
|
| 63 | +
|
| 64 | + MapsUtils::makePxValue($this->width);
|
| 65 | + MapsUtils::makePxValue($this->height);
|
| 66 | +
|
| 67 | + $markerItems = array();
|
| 68 | +
|
| 69 | + foreach ($this->m_locations as $location) {
|
| 70 | + // Create a string containing the marker JS
|
| 71 | + list($lat, $lon, $title, $label, $icon) = $location;
|
| 72 | +
|
| 73 | + $title = str_replace("'", "\'", $title);
|
| 74 | + $label = str_replace("'", "\'", $label);
|
| 75 | +
|
| 76 | + $markerItems[] = "getOLMarkerData($lon, $lat, '$title', '$label', '$icon')";
|
| 77 | + }
|
| 78 | +
|
| 79 | + $markersString = implode(',', $markerItems);
|
| 80 | +
|
| 81 | + $this->output .= "<div id='$this->mapName' style='width: $this->width; height: $this->height; background-color: #cccccc;'></div>
|
| 82 | + <script type='$wgJsMimeType'> /*<![CDATA[*/
|
| 83 | + addLoadEvent(
|
| 84 | + initOpenLayer('$this->mapName', $this->centre_lon, $this->centre_lat, $this->zoom, [$layerItems], [$controlItems], [$markersString])
|
| 85 | + );
|
| 86 | + /*]]>*/ </script>";
|
| 87 | + }
|
| 88 | +
|
| 89 | +}
|
Index: tags/extensions/SemanticMaps/REL_0_3_2/OpenLayers/SM_OpenLayersFormInput.php |
— | — | @@ -0,0 +1,79 @@ |
| 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 SemanticMaps
|
| 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 | + $this->showAddresFunction = 'showOLAddress'; |
| 30 | + |
| 31 | + $this->earthZoom = 1; |
| 32 | + |
| 33 | + $this->defaultParams = MapsOpenLayersUtils::getDefaultParams(); |
| 34 | + $this->defaultZoom = $egMapsOpenLayersZoom; |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * @see MapsMapFeature::doMapServiceLoad() |
| 39 | + * |
| 40 | + */ |
| 41 | + protected function doMapServiceLoad() { |
| 42 | + global $egOpenLayersOnThisPage; |
| 43 | + |
| 44 | + MapsOpenLayersUtils::addOLDependencies($this->output); |
| 45 | + $egOpenLayersOnThisPage++; |
| 46 | + |
| 47 | + $this->elementNr = $egOpenLayersOnThisPage; |
| 48 | + } |
| 49 | +
|
| 50 | + /** |
| 51 | + * @see MapsMapFeature::addSpecificMapHTML() |
| 52 | + * |
| 53 | + */
|
| 54 | + protected function addSpecificMapHTML() { |
| 55 | + global $wgJsMimeType; |
| 56 | + |
| 57 | + $controlItems = MapsOpenLayersUtils::createControlsString($this->controls); |
| 58 | + |
| 59 | + $layerItems = MapsOpenLayersUtils::createLayersStringAndLoadDependencies($this->output, $this->layers); |
| 60 | + |
| 61 | + $width = $this->width . 'px'; |
| 62 | + $height = $this->height . 'px'; |
| 63 | + |
| 64 | + $this->output .=" |
| 65 | + <div id='".$this->mapName."' style='width: $width; height: $height; background-color: #cccccc;'></div> |
| 66 | + |
| 67 | + <script type='$wgJsMimeType'>/*<![CDATA[*/ |
| 68 | + addLoadEvent(makeFormInputOpenLayer('".$this->mapName."', '".$this->coordsFieldName."', ".$this->centre_lat.", ".$this->centre_lon.", ".$this->zoom.", ".$this->marker_lat.", ".$this->marker_lon.", [$layerItems], [$controlItems])); |
| 69 | + /*]]>*/</script>";
|
| 70 | + } |
| 71 | + |
| 72 | + /** |
| 73 | + * @see SMFormInput::manageGeocoding() |
| 74 | + * |
| 75 | + */ |
| 76 | + protected function manageGeocoding() { |
| 77 | + $this->enableGeocoding = false; |
| 78 | + } |
| 79 | + |
| 80 | +} |
Index: tags/extensions/SemanticMaps/REL_0_3_2/INSTALL |
— | — | @@ -0,0 +1,16 @@ |
| 2 | +[[Semantic Maps 0.3.2]]
|
| 3 | +
|
| 4 | +Make sure you have Semantic MediaWiki and Maps successfully installed before
|
| 5 | +proceeding with the installation. Once you have downloaded the code, place
|
| 6 | +the 'SemanticMaps' directory within your MediaWiki 'extensions' directory.
|
| 7 | +Then add the following code to your LocalSettings.php file after the lines
|
| 8 | +that install Maps:
|
| 9 | +
|
| 10 | +# Semantic Maps
|
| 11 | +require_once( "$IP/extensions/SemanticMaps/SemanticMaps.php" );
|
| 12 | +
|
| 13 | +The inclusion of extensions should happen in this order: Semantic MediaWiki,
|
| 14 | +Semantic Forms (if you use it), Semantic Maps. Maps should proceed Semantic
|
| 15 | +Maps. See the installation instructions of Maps for info about the API keys.
|
| 16 | +
|
| 17 | +More information can be found at http://www.mediawiki.org/wiki/Extension:Semantic_Maps#Download_and_installation |
\ No newline at end of file |
Index: tags/extensions/SemanticMaps/REL_0_3_2/RELEASE-NOTES |
— | — | @@ -0,0 +1,58 @@ |
| 2 | +For a documentation of all features, see http://www.mediawiki.org/wiki/Extension:Semantic_Maps
|
| 3 | +
|
| 4 | +==Semantic Maps change log==
|
| 5 | +This change log contains a list of completed to-do's (new features, bug fixes, refactoring) for every version of Semantic Maps.
|
| 6 | +
|
| 7 | +===Semantic Maps 0.3.1===
|
| 8 | +(2009-08-18)
|
| 9 | +
|
| 10 | +====Bug fixes====
|
| 11 | +
|
| 12 | +* Fixed script design flaw that caused errors when using the 'map' format in a query.
|
| 13 | +
|
| 14 | +===Semantic Maps 0.3===
|
| 15 | +(2009-08-14)
|
| 16 | +
|
| 17 | +====New functionality====
|
| 18 | +
|
| 19 | +* Yahoo! Maps and OpenLayers now handle the "icon=" parameter that can come from Semantic Compound Queries, as Google Maps already did.
|
| 20 | +
|
| 21 | +====Refactoring====
|
| 22 | +
|
| 23 | +* Restructured the Query Printer classes (JavaScript based logic).
|
| 24 | +
|
| 25 | +* Made form input classes weakly typed, so they fully work with the new aliasing system.
|
| 26 | +
|
| 27 | +* Integrated the new hook system of Maps.
|
| 28 | +
|
| 29 | +* Made the form input class inherit from MapsMapFeature.
|
| 30 | +
|
| 31 | +====Bug fixes====
|
| 32 | +
|
| 33 | +* Mapping formats get added only once, as opossed to multiple times in version 0.2.2.
|
| 34 | +
|
| 35 | +* Added "elementNamePrefix" to the map names and fields of form inputs to prevent JavaScript errors.
|
| 36 | +
|
| 37 | +* When a query returns no results, nothing will be displayed, instead of an empty map.
|
| 38 | +
|
| 39 | +* The Google Maps form input now zooms in correctly when a user looks up an address.
|
| 40 | +
|
| 41 | +===Semantic Maps 0.2===
|
| 42 | +(2009-07-29)
|
| 43 | +
|
| 44 | +====New functionality====
|
| 45 | +
|
| 46 | +* Hook for [[Extension:Admin_Links|Admin Links]]
|
| 47 | +
|
| 48 | +* Multi geocoder integration with form inputs
|
| 49 | +
|
| 50 | +* Yahoo! Geocoder (for form inputs)
|
| 51 | +
|
| 52 | +====Refactoring====
|
| 53 | +
|
| 54 | +* Restructure the Form Input classes
|
| 55 | +
|
| 56 | +===Semantic Maps 0.1===
|
| 57 | +(2009-07-21)
|
| 58 | +
|
| 59 | +* Initial release, featuring both result formats and form inputs for Google Maps (+ Google Earth), Yahoo! Maps and OpenLayers
|
Index: tags/extensions/SemanticMaps/REL_0_3_2/SM_MapPrinter.php |
— | — | @@ -0,0 +1,240 @@ |
| 2 | +<?php
|
| 3 | +
|
| 4 | +/**
|
| 5 | + * Abstract class that provides the common functionallity for all map query printers
|
| 6 | + *
|
| 7 | + * @file SM_MapPrinter.php
|
| 8 | + * @ingroup SemanticMaps
|
| 9 | + *
|
| 10 | + * @author Jeroen De Dauw
|
| 11 | + * @author Robert Buzink
|
| 12 | + * @author Yaron Koren
|
| 13 | + */
|
| 14 | +
|
| 15 | +if( !defined( 'MEDIAWIKI' ) ) {
|
| 16 | + die( 'Not an entry point.' );
|
| 17 | +}
|
| 18 | +
|
| 19 | +abstract class SMMapPrinter extends SMWResultPrinter {
|
| 20 | +
|
| 21 | + /**
|
| 22 | + * Sets the map service specific element name
|
| 23 | + */
|
| 24 | + protected abstract function setQueryPrinterSettings();
|
| 25 | +
|
| 26 | + /**
|
| 27 | + * Map service spesific map count and loading of dependencies
|
| 28 | + */
|
| 29 | + protected abstract function doMapServiceLoad();
|
| 30 | +
|
| 31 | + /**
|
| 32 | + * Gets the query result
|
| 33 | + */
|
| 34 | + protected abstract function addSpecificMapHTML();
|
| 35 | +
|
| 36 | + public $serviceName;
|
| 37 | +
|
| 38 | + protected $defaultParams = array();
|
| 39 | +
|
| 40 | + protected $m_locations = array();
|
| 41 | +
|
| 42 | + protected $defaultZoom;
|
| 43 | + protected $elementNr;
|
| 44 | + protected $elementNamePrefix;
|
| 45 | +
|
| 46 | + protected $mapName;
|
| 47 | +
|
| 48 | + protected $centre_lat;
|
| 49 | + protected $centre_lon;
|
| 50 | +
|
| 51 | + protected $output = '';
|
| 52 | +
|
| 53 | + protected $mapFeature;
|
| 54 | +
|
| 55 | + /**
|
| 56 | + * Builds up and returns the HTML for the map, with the queried coordinate data on it.
|
| 57 | + *
|
| 58 | + * @param unknown_type $res
|
| 59 | + * @param unknown_type $outputmode
|
| 60 | + * @return array
|
| 61 | + */
|
| 62 | + public final function getResultText($res, $outputmode) {
|
| 63 | + $this->formatResultData($res, $outputmode);
|
| 64 | +
|
| 65 | + $this->setQueryPrinterSettings();
|
| 66 | +
|
| 67 | + $this->manageMapProperties($this->m_params);
|
| 68 | +
|
| 69 | + // Only create a map when there is at least one result.
|
| 70 | + if (count($this->m_locations) > 0) {
|
| 71 | + $this->doMapServiceLoad();
|
| 72 | +
|
| 73 | + $this->setMapName();
|
| 74 | +
|
| 75 | + $this->setZoom();
|
| 76 | +
|
| 77 | + $this->setCentre();
|
| 78 | +
|
| 79 | + $this->addSpecificMapHTML();
|
| 80 | + }
|
| 81 | +
|
| 82 | + return array($this->output, 'noparse' => 'true', 'isHTML' => 'true');
|
| 83 | + }
|
| 84 | +
|
| 85 | + public final function getResult($results, $params, $outputmode) {
|
| 86 | + // Skip checks, results with 0 entries are normal
|
| 87 | + $this->readParameters($params, $outputmode);
|
| 88 | + return $this->getResultText($results, SMW_OUTPUT_HTML);
|
| 89 | + }
|
| 90 | +
|
| 91 | + private function formatResultData($res, $outputmode) {
|
| 92 | + while ( ($row = $res->getNext()) !== false ) {
|
| 93 | + $this->addResultRow($outputmode, $row);
|
| 94 | + }
|
| 95 | + }
|
| 96 | +
|
| 97 | + /**
|
| 98 | + * This function will loop through all properties (fields) of one record (row),
|
| 99 | + * and add the location data, title, label and icon to the m_locations array.
|
| 100 | + *
|
| 101 | + * @param unknown_type $outputmode
|
| 102 | + * @param unknown_type $row The record you want to add data from
|
| 103 | + */
|
| 104 | + private function addResultRow($outputmode, $row) {
|
| 105 | + global $wgUser;
|
| 106 | + $skin = $wgUser->getSkin();
|
| 107 | +
|
| 108 | + $title = '';
|
| 109 | + $text = '';
|
| 110 | + $lat = '';
|
| 111 | + $lon = '';
|
| 112 | +
|
| 113 | + // Loop throught all fields of the record
|
| 114 | + foreach ($row as $i => $field) {
|
| 115 | + $pr = $field->getPrintRequest();
|
| 116 | +
|
| 117 | + // Loop throught all the parts of the field value
|
| 118 | + while ( ($object = $field->getNextObject()) !== false ) {
|
| 119 | + if ($object->getTypeID() == '_wpg' && $i == 0) {
|
| 120 | + $title = $object->getLongText($outputmode, $skin);
|
| 121 | + }
|
| 122 | +
|
| 123 | + if ($object->getTypeID() != '_geo' && $i != 0) {
|
| 124 | + $text .= $pr->getHTMLText($skin) . ": " . $object->getLongText($outputmode, $skin) . "<br />";
|
| 125 | + }
|
| 126 | +
|
| 127 | + if ($pr->getMode() == SMWPrintRequest::PRINT_PROP && $pr->getTypeID() == '_geo') {
|
| 128 | + list($lat,$lon) = explode(',', $object->getXSDValue());
|
| 129 | + }
|
| 130 | + }
|
| 131 | + }
|
| 132 | +
|
| 133 | + if (strlen($lat) > 0 && strlen($lon) > 0) {
|
| 134 | + $icon = $this->getLocationIcon($row);
|
| 135 | + $this->m_locations[] = array($lat, $lon, $title, $text, $icon);
|
| 136 | + }
|
| 137 | + }
|
| 138 | +
|
| 139 | + /**
|
| 140 | + * Get the icon for a row
|
| 141 | + *
|
| 142 | + * @param unknown_type $row
|
| 143 | + * @return unknown
|
| 144 | + */
|
| 145 | + private function getLocationIcon($row) {
|
| 146 | + $icon = '';
|
| 147 | + $legend_labels = array();
|
| 148 | +
|
| 149 | + // Look for display_options field, which can be set by Semantic Compound Queries
|
| 150 | + if (property_exists($row[0], 'display_options')) {
|
| 151 | + if (array_key_exists('icon', $row[0]->display_options)) {
|
| 152 | + $icon = $row[0]->display_options['icon'];
|
| 153 | +
|
| 154 | + // This is somewhat of a hack - if a legend label has been set, we're getting it for every point, instead of just once per icon
|
| 155 | + if (array_key_exists('legend label', $row[0]->display_options)) {
|
| 156 | +
|
| 157 | + $legend_label = $row[0]->display_options['legend label'];
|
| 158 | +
|
| 159 | + if (! array_key_exists($icon, $legend_labels)) {
|
| 160 | + $legend_labels[$icon] = $legend_label;
|
| 161 | + }
|
| 162 | + }
|
| 163 | + }
|
| 164 | + // Icon can be set even for regular, non-compound queries If it is, though, we have to translate the name into a URL here
|
| 165 | + } elseif (array_key_exists('icon', $this->m_params)) {
|
| 166 | +
|
| 167 | + $icon_title = Title::newFromText($this->m_params['icon']);
|
| 168 | + $icon_image_page = new ImagePage($icon_title);
|
| 169 | + $icon = $icon_image_page->getDisplayedFile()->getURL();
|
| 170 | + }
|
| 171 | +
|
| 172 | + return $icon;
|
| 173 | + }
|
| 174 | +
|
| 175 | + private function manageMapProperties($mapProperties) {
|
| 176 | + global $egMapsServices;
|
| 177 | +
|
| 178 | + $mapProperties = MapsMapper::getValidParams($mapProperties, $egMapsServices[$this->serviceName]['parameters']);
|
| 179 | + $mapProperties = MapsMapper::setDefaultParValues($mapProperties, $this->defaultParams);
|
| 180 | +
|
| 181 | + if (isset($this->serviceName)) $mapProperties['service'] = $this->serviceName;
|
| 182 | +
|
| 183 | + // Go through the array with map parameters and create new variables
|
| 184 | + // with the name of the key and value of the item if they don't exist on class level yet.
|
| 185 | + foreach($mapProperties as $paramName => $paramValue) {
|
| 186 | + if (!property_exists(__CLASS__, $paramName)) {
|
| 187 | + $this->{$paramName} = $paramValue;
|
| 188 | + }
|
| 189 | + }
|
| 190 | +
|
| 191 | + MapsMapper::enforceArrayValues($this->controls);
|
| 192 | + }
|
| 193 | +
|
| 194 | + /**
|
| 195 | + * Sets the zoom level to the provided value, or when not set, to the default.
|
| 196 | + *
|
| 197 | + */
|
| 198 | + private function setZoom() {
|
| 199 | + if (strlen($this->zoom) < 1) {
|
| 200 | + if (count($this->m_locations) > 1) {
|
| 201 | + $this->zoom = 'null';
|
| 202 | + }
|
| 203 | + else {
|
| 204 | + $this->zoom = $this->defaultZoom;
|
| 205 | + }
|
| 206 | + }
|
| 207 | + }
|
| 208 | +
|
| 209 | + /**
|
| 210 | + * Sets the $centre_lat and $centre_lon fields.
|
| 211 | + * Note: this needs to be done AFTRE the maker coordinates are set.
|
| 212 | + *
|
| 213 | + */
|
| 214 | + private function setCentre() {
|
| 215 | + if (strlen($this->centre) > 0) {
|
| 216 | + // If a centre value is set, use it.
|
| 217 | + $centre = MapsUtils::getLatLon($this->centre);
|
| 218 | + $this->centre_lat = $centre['lat'];
|
| 219 | + $this->centre_lon = $centre['lon'];
|
| 220 | + }
|
| 221 | + elseif (count($this->m_locations) > 1) {
|
| 222 | + // If centre is not set, and there are multiple points, set the values to null, to be auto determined by the JS of the mapping API.
|
| 223 | + $this->centre_lat = 'null';
|
| 224 | + $this->centre_lon = 'null';
|
| 225 | + }
|
| 226 | + else {
|
| 227 | + // If centre is not set and there is exactelly one marker, use it's coordinates.
|
| 228 | + $this->centre_lat = $this->m_locations[0][0];
|
| 229 | + $this->centre_lon = $this->m_locations[0][1];
|
| 230 | + }
|
| 231 | + }
|
| 232 | +
|
| 233 | + /**
|
| 234 | + * Sets the $mapName field, using the $elementNamePrefix and $elementNr.
|
| 235 | + *
|
| 236 | + */
|
| 237 | + protected function setMapName() {
|
| 238 | + $this->mapName = $this->elementNamePrefix.'_'.$this->elementNr;
|
| 239 | + }
|
| 240 | +
|
| 241 | +}
|
Index: tags/extensions/SemanticMaps/REL_0_3_2/COPYING |
— | — | @@ -0,0 +1,348 @@ |
| 2 | +The license text below "----" applies to all files within this distribution, other
|
| 3 | +than those that are in a directory which contains files named "LICENSE" or
|
| 4 | +"COPYING", or a subdirectory thereof. For those files, the license text contained in
|
| 5 | +said file overrides any license information contained in directories of smaller depth.
|
| 6 | +Alternative licenses are typically used for software that is provided by external
|
| 7 | +parties, and merely packaged with the Semantic MediaWiki release for convenience.
|
| 8 | +----
|
| 9 | +
|
| 10 | + GNU GENERAL PUBLIC LICENSE
|
| 11 | + Version 2, June 1991
|
| 12 | +
|
| 13 | + Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
| 14 | + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 15 | + Everyone is permitted to copy and distribute verbatim copies
|
| 16 | + of this license document, but changing it is not allowed.
|
| 17 | +
|
| 18 | + Preamble
|
| 19 | +
|
| 20 | + The licenses for most software are designed to take away your
|
| 21 | +freedom to share and change it. By contrast, the GNU General Public
|
| 22 | +License is intended to guarantee your freedom to share and change free
|
| 23 | +software--to make sure the software is free for all its users. This
|
| 24 | +General Public License applies to most of the Free Software
|
| 25 | +Foundation's software and to any other program whose authors commit to
|
| 26 | +using it. (Some other Free Software Foundation software is covered by
|
| 27 | +the GNU Library General Public License instead.) You can apply it to
|
| 28 | +your programs, too.
|
| 29 | +
|
| 30 | + When we speak of free software, we are referring to freedom, not
|
| 31 | +price. Our General Public Licenses are designed to make sure that you
|
| 32 | +have the freedom to distribute copies of free software (and charge for
|
| 33 | +this service if you wish), that you receive source code or can get it
|
| 34 | +if you want it, that you can change the software or use pieces of it
|
| 35 | +in new free programs; and that you know you can do these things.
|
| 36 | +
|
| 37 | + To protect your rights, we need to make restrictions that forbid
|
| 38 | +anyone to deny you these rights or to ask you to surrender the rights.
|
| 39 | +These restrictions translate to certain responsibilities for you if you
|
| 40 | +distribute copies of the software, or if you modify it.
|
| 41 | +
|
| 42 | + For example, if you distribute copies of such a program, whether
|
| 43 | +gratis or for a fee, you must give the recipients all the rights that
|
| 44 | +you have. You must make sure that they, too, receive or can get the
|
| 45 | +source code. And you must show them these terms so they know their
|
| 46 | +rights.
|
| 47 | +
|
| 48 | + We protect your rights with two steps: (1) copyright the software, and
|
| 49 | +(2) offer you this license which gives you legal permission to copy,
|
| 50 | +distribute and/or modify the software.
|
| 51 | +
|
| 52 | + Also, for each author's protection and ours, we want to make certain
|
| 53 | +that everyone understands that there is no warranty for this free
|
| 54 | +software. If the software is modified by someone else and passed on, we
|
| 55 | +want its recipients to know that what they have is not the original, so
|
| 56 | +that any problems introduced by others will not reflect on the original
|
| 57 | +authors' reputations.
|
| 58 | +
|
| 59 | + Finally, any free program is threatened constantly by software
|
| 60 | +patents. We wish to avoid the danger that redistributors of a free
|
| 61 | +program will individually obtain patent licenses, in effect making the
|
| 62 | +program proprietary. To prevent this, we have made it clear that any
|
| 63 | +patent must be licensed for everyone's free use or not licensed at all.
|
| 64 | +
|
| 65 | + The precise terms and conditions for copying, distribution and
|
| 66 | +modification follow.
|
| 67 | +
|
| 68 | + GNU GENERAL PUBLIC LICENSE
|
| 69 | + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
| 70 | +
|
| 71 | + 0. This License applies to any program or other work which contains
|
| 72 | +a notice placed by the copyright holder saying it may be distributed
|
| 73 | +under the terms of this General Public License. The "Program", below,
|
| 74 | +refers to any such program or work, and a "work based on the Program"
|
| 75 | +means either the Program or any derivative work under copyright law:
|
| 76 | +that is to say, a work containing the Program or a portion of it,
|
| 77 | +either verbatim or with modifications and/or translated into another
|
| 78 | +language. (Hereinafter, translation is included without limitation in
|
| 79 | +the term "modification".) Each licensee is addressed as "you".
|
| 80 | +
|
| 81 | +Activities other than copying, distribution and modification are not
|
| 82 | +covered by this License; they are outside its scope. The act of
|
| 83 | +running the Program is not restricted, and the output from the Program
|
| 84 | +is covered only if its contents constitute a work based on the
|
| 85 | +Program (independent of having been made by running the Program).
|
| 86 | +Whether that is true depends on what the Program does.
|
| 87 | +
|
| 88 | + 1. You may copy and distribute verbatim copies of the Program's
|
| 89 | +source code as you receive it, in any medium, provided that you
|
| 90 | +conspicuously and appropriately publish on each copy an appropriate
|
| 91 | +copyright notice and disclaimer of warranty; keep intact all the
|
| 92 | +notices that refer to this License and to the absence of any warranty;
|
| 93 | +and give any other recipients of the Program a copy of this License
|
| 94 | +along with the Program.
|
| 95 | +
|
| 96 | +You may charge a fee for the physical act of transferring a copy, and
|
| 97 | +you may at your option offer warranty protection in exchange for a fee.
|
| 98 | +
|
| 99 | + 2. You may modify your copy or copies of the Program or any portion
|
| 100 | +of it, thus forming a work based on the Program, and copy and
|
| 101 | +distribute such modifications or work under the terms of Section 1
|
| 102 | +above, provided that you also meet all of these conditions:
|
| 103 | +
|
| 104 | + a) You must cause the modified files to carry prominent notices
|
| 105 | + stating that you changed the files and the date of any change.
|
| 106 | +
|
| 107 | + b) You must cause any work that you distribute or publish, that in
|
| 108 | + whole or in part contains or is derived from the Program or any
|
| 109 | + part thereof, to be licensed as a whole at no charge to all third
|
| 110 | + parties under the terms of this License.
|
| 111 | +
|
| 112 | + c) If the modified program normally reads commands interactively
|
| 113 | + when run, you must cause it, when started running for such
|
| 114 | + interactive use in the most ordinary way, to print or display an
|
| 115 | + announcement including an appropriate copyright notice and a
|
| 116 | + notice that there is no warranty (or else, saying that you provide
|
| 117 | + a warranty) and that users may redistribute the program under
|
| 118 | + these conditions, and telling the user how to view a copy of this
|
| 119 | + License. (Exception: if the Program itself is interactive but
|
| 120 | + does not normally print such an announcement, your work based on
|
| 121 | + the Program is not required to print an announcement.)
|
| 122 | +
|
| 123 | +These requirements apply to the modified work as a whole. If
|
| 124 | +identifiable sections of that work are not derived from the Program,
|
| 125 | +and can be reasonably considered independent and separate works in
|
| 126 | +themselves, then this License, and its terms, do not apply to those
|
| 127 | +sections when you distribute them as separate works. But when you
|
| 128 | +distribute the same sections as part of a whole which is a work based
|
| 129 | +on the Program, the distribution of the whole must be on the terms of
|
| 130 | +this License, whose permissions for other licensees extend to the
|
| 131 | +entire whole, and thus to each and every part regardless of who wrote it.
|
| 132 | +
|
| 133 | +Thus, it is not the intent of this section to claim rights or contest
|
| 134 | +your rights to work written entirely by you; rather, the intent is to
|
| 135 | +exercise the right to control the distribution of derivative or
|
| 136 | +collective works based on the Program.
|
| 137 | +
|
| 138 | +In addition, mere aggregation of another work not based on the Program
|
| 139 | +with the Program (or with a work based on the Program) on a volume of
|
| 140 | +a storage or distribution medium does not bring the other work under
|
| 141 | +the scope of this License.
|
| 142 | +
|
| 143 | + 3. You may copy and distribute the Program (or a work based on it,
|
| 144 | +under Section 2) in object code or executable form under the terms of
|
| 145 | +Sections 1 and 2 above provided that you also do one of the following:
|
| 146 | +
|
| 147 | + a) Accompany it with the complete corresponding machine-readable
|
| 148 | + source code, which must be distributed under the terms of Sections
|
| 149 | + 1 and 2 above on a medium customarily used for software interchange; or,
|
| 150 | +
|
| 151 | + b) Accompany it with a written offer, valid for at least three
|
| 152 | + years, to give any third party, for a charge no more than your
|
| 153 | + cost of physically performing source distribution, a complete
|
| 154 | + machine-readable copy of the corresponding source code, to be
|
| 155 | + distributed under the terms of Sections 1 and 2 above on a medium
|
| 156 | + customarily used for software interchange; or,
|
| 157 | +
|
| 158 | + c) Accompany it with the information you received as to the offer
|
| 159 | + to distribute corresponding source code. (This alternative is
|
| 160 | + allowed only for noncommercial distribution and only if you
|
| 161 | + received the program in object code or executable form with such
|
| 162 | + an offer, in accord with Subsection b above.)
|
| 163 | +
|
| 164 | +The source code for a work means the preferred form of the work for
|
| 165 | +making modifications to it. For an executable work, complete source
|
| 166 | +code means all the source code for all modules it contains, plus any
|
| 167 | +associated interface definition files, plus the scripts used to
|
| 168 | +control compilation and installation of the executable. However, as a
|
| 169 | +special exception, the source code distributed need not include
|
| 170 | +anything that is normally distributed (in either source or binary
|
| 171 | +form) with the major components (compiler, kernel, and so on) of the
|
| 172 | +operating system on which the executable runs, unless that component
|
| 173 | +itself accompanies the executable.
|
| 174 | +
|
| 175 | +If distribution of executable or object code is made by offering
|
| 176 | +access to copy from a designated place, then offering equivalent
|
| 177 | +access to copy the source code from the same place counts as
|
| 178 | +distribution of the source code, even though third parties are not
|
| 179 | +compelled to copy the source along with the object code.
|
| 180 | +
|
| 181 | + 4. You may not copy, modify, sublicense, or distribute the Program
|
| 182 | +except as expressly provided under this License. Any attempt
|
| 183 | +otherwise to copy, modify, sublicense or distribute the Program is
|
| 184 | +void, and will automatically terminate your rights under this License.
|
| 185 | +However, parties who have received copies, or rights, from you under
|
| 186 | +this License will not have their licenses terminated so long as such
|
| 187 | +parties remain in full compliance.
|
| 188 | +
|
| 189 | + 5. You are not required to accept this License, since you have not
|
| 190 | +signed it. However, nothing else grants you permission to modify or
|
| 191 | +distribute the Program or its derivative works. These actions are
|
| 192 | +prohibited by law if you do not accept this License. Therefore, by
|
| 193 | +modifying or distributing the Program (or any work based on the
|
| 194 | +Program), you indicate your acceptance of this License to do so, and
|
| 195 | +all its terms and conditions for copying, distributing or modifying
|
| 196 | +the Program or works based on it.
|
| 197 | +
|
| 198 | + 6. Each time you redistribute the Program (or any work based on the
|
| 199 | +Program), the recipient automatically receives a license from the
|
| 200 | +original licensor to copy, distribute or modify the Program subject to
|
| 201 | +these terms and conditions. You may not impose any further
|
| 202 | +restrictions on the recipients' exercise of the rights granted herein.
|
| 203 | +You are not responsible for enforcing compliance by third parties to
|
| 204 | +this License.
|
| 205 | +
|
| 206 | + 7. If, as a consequence of a court judgment or allegation of patent
|
| 207 | +infringement or for any other reason (not limited to patent issues),
|
| 208 | +conditions are imposed on you (whether by court order, agreement or
|
| 209 | +otherwise) that contradict the conditions of this License, they do not
|
| 210 | +excuse you from the conditions of this License. If you cannot
|
| 211 | +distribute so as to satisfy simultaneously your obligations under this
|
| 212 | +License and any other pertinent obligations, then as a consequence you
|
| 213 | +may not distribute the Program at all. For example, if a patent
|
| 214 | +license would not permit royalty-free redistribution of the Program by
|
| 215 | +all those who receive copies directly or indirectly through you, then
|
| 216 | +the only way you could satisfy both it and this License would be to
|
| 217 | +refrain entirely from distribution of the Program.
|
| 218 | +
|
| 219 | +If any portion of this section is held invalid or unenforceable under
|
| 220 | +any particular circumstance, the balance of the section is intended to
|
| 221 | +apply and the section as a whole is intended to apply in other
|
| 222 | +circumstances.
|
| 223 | +
|
| 224 | +It is not the purpose of this section to induce you to infringe any
|
| 225 | +patents or other property right claims or to contest validity of any
|
| 226 | +such claims; this section has the sole purpose of protecting the
|
| 227 | +integrity of the free software distribution system, which is
|
| 228 | +implemented by public license practices. Many people have made
|
| 229 | +generous contributions to the wide range of software distributed
|
| 230 | +through that system in reliance on consistent application of that
|
| 231 | +system; it is up to the author/donor to decide if he or she is willing
|
| 232 | +to distribute software through any other system and a licensee cannot
|
| 233 | +impose that choice.
|
| 234 | +
|
| 235 | +This section is intended to make thoroughly clear what is believed to
|
| 236 | +be a consequence of the rest of this License.
|
| 237 | +
|
| 238 | + 8. If the distribution and/or use of the Program is restricted in
|
| 239 | +certain countries either by patents or by copyrighted interfaces, the
|
| 240 | +original copyright holder who places the Program under this License
|
| 241 | +may add an explicit geographical distribution limitation excluding
|
| 242 | +those countries, so that distribution is permitted only in or among
|
| 243 | +countries not thus excluded. In such case, this License incorporates
|
| 244 | +the limitation as if written in the body of this License.
|
| 245 | +
|
| 246 | + 9. The Free Software Foundation may publish revised and/or new versions
|
| 247 | +of the General Public License from time to time. Such new versions will
|
| 248 | +be similar in spirit to the present version, but may differ in detail to
|
| 249 | +address new problems or concerns.
|
| 250 | +
|
| 251 | +Each version is given a distinguishing version number. If the Program
|
| 252 | +specifies a version number of this License which applies to it and "any
|
| 253 | +later version", you have the option of following the terms and conditions
|
| 254 | +either of that version or of any later version published by the Free
|
| 255 | +Software Foundation. If the Program does not specify a version number of
|
| 256 | +this License, you may choose any version ever published by the Free Software
|
| 257 | +Foundation.
|
| 258 | +
|
| 259 | + 10. If you wish to incorporate parts of the Program into other free
|
| 260 | +programs whose distribution conditions are different, write to the author
|
| 261 | +to ask for permission. For software which is copyrighted by the Free
|
| 262 | +Software Foundation, write to the Free Software Foundation; we sometimes
|
| 263 | +make exceptions for this. Our decision will be guided by the two goals
|
| 264 | +of preserving the free status of all derivatives of our free software and
|
| 265 | +of promoting the sharing and reuse of software generally.
|
| 266 | +
|
| 267 | + NO WARRANTY
|
| 268 | +
|
| 269 | + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
| 270 | +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
| 271 | +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
| 272 | +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
| 273 | +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
| 274 | +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
| 275 | +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
| 276 | +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
| 277 | +REPAIR OR CORRECTION.
|
| 278 | +
|
| 279 | + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
| 280 | +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
| 281 | +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
| 282 | +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
| 283 | +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
| 284 | +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
| 285 | +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
| 286 | +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
| 287 | +POSSIBILITY OF SUCH DAMAGES.
|
| 288 | +
|
| 289 | + END OF TERMS AND CONDITIONS
|
| 290 | +
|
| 291 | + How to Apply These Terms to Your New Programs
|
| 292 | +
|
| 293 | + If you develop a new program, and you want it to be of the greatest
|
| 294 | +possible use to the public, the best way to achieve this is to make it
|
| 295 | +free software which everyone can redistribute and change under these terms.
|
| 296 | +
|
| 297 | + To do so, attach the following notices to the program. It is safest
|
| 298 | +to attach them to the start of each source file to most effectively
|
| 299 | +convey the exclusion of warranty; and each file should have at least
|
| 300 | +the "copyright" line and a pointer to where the full notice is found.
|
| 301 | +
|
| 302 | + <one line to give the program's name and a brief idea of what it does.>
|
| 303 | + Copyright (C) <year> <name of author>
|
| 304 | +
|
| 305 | + This program is free software; you can redistribute it and/or modify
|
| 306 | + it under the terms of the GNU General Public License as published by
|
| 307 | + the Free Software Foundation; either version 2 of the License, or
|
| 308 | + (at your option) any later version.
|
| 309 | +
|
| 310 | + This program is distributed in the hope that it will be useful,
|
| 311 | + but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 312 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 313 | + GNU General Public License for more details.
|
| 314 | +
|
| 315 | + You should have received a copy of the GNU General Public License
|
| 316 | + along with this program; if not, write to the Free Software
|
| 317 | + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 318 | +
|
| 319 | +
|
| 320 | +Also add information on how to contact you by electronic and paper mail.
|
| 321 | +
|
| 322 | +If the program is interactive, make it output a short notice like this
|
| 323 | +when it starts in an interactive mode:
|
| 324 | +
|
| 325 | + Gnomovision version 69, Copyright (C) year name of author
|
| 326 | + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
| 327 | + This is free software, and you are welcome to redistribute it
|
| 328 | + under certain conditions; type `show c' for details.
|
| 329 | +
|
| 330 | +The hypothetical commands `show w' and `show c' should show the appropriate
|
| 331 | +parts of the General Public License. Of course, the commands you use may
|
| 332 | +be called something other than `show w' and `show c'; they could even be
|
| 333 | +mouse-clicks or menu items--whatever suits your program.
|
| 334 | +
|
| 335 | +You should also get your employer (if you work as a programmer) or your
|
| 336 | +school, if any, to sign a "copyright disclaimer" for the program, if
|
| 337 | +necessary. Here is a sample; alter the names:
|
| 338 | +
|
| 339 | + Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
| 340 | + `Gnomovision' (which makes passes at compilers) written by James Hacker.
|
| 341 | +
|
| 342 | + <signature of Ty Coon>, 1 April 1989
|
| 343 | + Ty Coon, President of Vice
|
| 344 | +
|
| 345 | +This General Public License does not permit incorporating your program into
|
| 346 | +proprietary programs. If your program is a subroutine library, you may
|
| 347 | +consider it more useful to permit linking proprietary applications with the
|
| 348 | +library. If this is what you want to do, use the GNU Library General
|
| 349 | +Public License instead of this License.
|
Index: tags/extensions/SemanticMaps/REL_0_3_2/SM_FormInput.php |
— | — | @@ -0,0 +1,145 @@ |
| 2 | +<?php
|
| 3 | +
|
| 4 | +/**
|
| 5 | + * Abstract class that provides the common functionallity for all map form inputs
|
| 6 | + *
|
| 7 | + * @file SM_FormInput.php
|
| 8 | + * @ingroup SemanticMaps
|
| 9 | + *
|
| 10 | + * @author Jeroen De Dauw
|
| 11 | + */
|
| 12 | +
|
| 13 | +if( !defined( 'MEDIAWIKI' ) ) {
|
| 14 | + die( 'Not an entry point.' );
|
| 15 | +}
|
| 16 | +
|
| 17 | +abstract class SMFormInput extends MapsMapFeature {
|
| 18 | +
|
| 19 | + /**
|
| 20 | + * Determine if geocoding will be enabled and load the required dependencies.
|
| 21 | + */
|
| 22 | + protected abstract function manageGeocoding();
|
| 23 | +
|
| 24 | + protected $marker_lat;
|
| 25 | + protected $marker_lon;
|
| 26 | +
|
| 27 | + protected $earthZoom;
|
| 28 | +
|
| 29 | + protected $showAddresFunction;
|
| 30 | +
|
| 31 | + protected $enableGeocoding = false;
|
| 32 | +
|
| 33 | + private $startingCoords ='';
|
| 34 | +
|
| 35 | + private $coordinates;
|
| 36 | +
|
| 37 | + /**
|
| 38 | + * This function is a hook for Semantic Forms, and returns the HTML needed in
|
| 39 | + * the form to handle coordinate data.
|
| 40 | + */
|
| 41 | + public final function formInputHTML($coordinates, $input_name, $is_mandatory, $is_disabled, $field_args) {
|
| 42 | + // TODO: Use function args for sf stuffz
|
| 43 | + global $sfgTabIndex;
|
| 44 | +
|
| 45 | + $this->coordinates = $coordinates;
|
| 46 | +
|
| 47 | + $this->manageGeocoding();
|
| 48 | +
|
| 49 | + $this->setMapSettings();
|
| 50 | +
|
| 51 | + $this->doMapServiceLoad();
|
| 52 | +
|
| 53 | + $this->manageMapProperties($field_args, __CLASS__);
|
| 54 | +
|
| 55 | + $this->setCoordinates();
|
| 56 | + $this->setCentre();
|
| 57 | + $this->setZoom();
|
| 58 | +
|
| 59 | + // Create html element names
|
| 60 | + $this->setMapName();
|
| 61 | + $this->mapName .= '_'.$sfgTabIndex;
|
| 62 | + $this->geocodeFieldName = $this->elementNamePrefix.'_geocode_'.$this->elementNr.'_'.$sfgTabIndex;
|
| 63 | + $this->coordsFieldName = $this->elementNamePrefix.'_coords_'.$this->elementNr.'_'.$sfgTabIndex;
|
| 64 | + $this->infoFieldName = $this->elementNamePrefix.'_info_'.$this->elementNr.'_'.$sfgTabIndex;
|
| 65 | +
|
| 66 | + // Create the non specific form HTML
|
| 67 | + $this->output .= "
|
| 68 | + <input id='".$this->coordsFieldName."' name='$input_name' type='text' value='$this->startingCoords' size='40' tabindex='$sfgTabIndex'>
|
| 69 | + <span id='".$this->infoFieldName."' class='error_message'></span>";
|
| 70 | +
|
| 71 | + if ($this->enableGeocoding) {
|
| 72 | + $sfgTabIndex++;
|
| 73 | +
|
| 74 | + // Retrieve language values
|
| 75 | + wfLoadExtensionMessages( 'SemanticMaps' );
|
| 76 | + $enter_address_here_text = wfMsg('semanticmaps_enteraddresshere');
|
| 77 | + $lookup_coordinates_text = wfMsg('semanticmaps_lookupcoordinates');
|
| 78 | + $not_found_text = wfMsg('semanticmaps_notfound');
|
| 79 | +
|
| 80 | + $adress_field = smfGetDynamicInput($this->geocodeFieldName, $enter_address_here_text, 'size="30" name="geocode" style="color: #707070" tabindex="'.$sfgTabIndex.'"');
|
| 81 | + $this->output .= "
|
| 82 | + <p>
|
| 83 | + $adress_field
|
| 84 | + <input type='submit' onClick=\"$this->showAddresFunction(document.forms['createbox'].$this->geocodeFieldName.value, '$this->mapName', '$this->coordsFieldName', '$not_found_text'); return false\" value='$lookup_coordinates_text' />
|
| 85 | + </p>";
|
| 86 | + }
|
| 87 | +
|
| 88 | + $this->addSpecificMapHTML();
|
| 89 | +
|
| 90 | + return array($this->output, '');
|
| 91 | + }
|
| 92 | +
|
| 93 | + /**
|
| 94 | + * Sets the zoom so the whole map is visible in case there is no maker yet,
|
| 95 | + * and sets it to the default when there is a marker but no zoom parameter.
|
| 96 | + */
|
| 97 | + private function setZoom() {
|
| 98 | + if (empty($this->coordinates)) {
|
| 99 | + $this->zoom = $this->earthZoom;
|
| 100 | + } else if (strlen($this->zoom) < 1) {
|
| 101 | + $this->zoom = $this->defaultZoom;
|
| 102 | + }
|
| 103 | + }
|
| 104 | +
|
| 105 | + /**
|
| 106 | + * Sets the $marler_lon and $marler_lat fields and when set, the starting coordinates
|
| 107 | + *
|
| 108 | + */
|
| 109 | + private function setCoordinates() {
|
| 110 | + if (empty($this->coordinates)) {
|
| 111 | + // If no coordinates exist yet, no marker should be displayed
|
| 112 | + $this->marker_lat = 'null';
|
| 113 | + $this->marker_lon = 'null';
|
| 114 | + }
|
| 115 | + else {
|
| 116 | + $marker = MapsUtils::getLatLon($this->coordinates);
|
| 117 | + $this->marker_lat = $marker['lat'];
|
| 118 | + $this->marker_lon = $marker['lon'];
|
| 119 | + $this->startingCoords = MapsUtils::latDecimal2Degree($this->marker_lat) . ', ' . MapsUtils::lonDecimal2Degree($this->marker_lon);
|
| 120 | + }
|
| 121 | + }
|
| 122 | +
|
| 123 | + /**
|
| 124 | + * Sets the $centre_lat and $centre_lon fields.
|
| 125 | + * Note: this needs to be done AFTRE the maker coordinates are set.
|
| 126 | + *
|
| 127 | + */
|
| 128 | + private function setCentre() {
|
| 129 | + if (empty($this->centre)) {
|
| 130 | + if (isset($this->coordinates)) {
|
| 131 | + $this->centre_lat = $this->marker_lat;
|
| 132 | + $this->centre_lon = $this->marker_lon;
|
| 133 | + }
|
| 134 | + else {
|
| 135 | + $this->centre_lat = '0';
|
| 136 | + $this->centre_lon = '0';
|
| 137 | + }
|
| 138 | + }
|
| 139 | + else {
|
| 140 | + $centre = MapsUtils::getLatLon($this->centre);
|
| 141 | + $this->centre_lat = $centre['lat'];
|
| 142 | + $this->centre_lon = $centre['lon'];
|
| 143 | + }
|
| 144 | + }
|
| 145 | +}
|
| 146 | +
|
Index: tags/extensions/SemanticMaps/REL_0_3_2/SemanticMaps.i18n.php |
— | — | @@ -0,0 +1,474 @@ |
| 2 | +<?php
|
| 3 | +
|
| 4 | +/**
|
| 5 | + * Internationalization file for the Semantic Maps extension
|
| 6 | + *
|
| 7 | + * @file SemanticMaps.i18n.php
|
| 8 | + * @ingroup Semantic Maps
|
| 9 | + *
|
| 10 | + * @author Jeroen De Dauw
|
| 11 | + */
|
| 12 | +
|
| 13 | +$messages = array();
|
| 14 | +
|
| 15 | +/** English
|
| 16 | + * @author Jeroen De Dauw
|
| 17 | + */
|
| 18 | +
|
| 19 | +$messages['en'] = array(
|
| 20 | + 'semanticmaps_name' => 'Semantic Maps',
|
| 21 | + 'semanticmaps_desc' => "Provides the ability to view and edit coordinate data stored through the Semantic MediaWiki extension ([http://wiki.bn2vs.com/wiki/Semantic_Maps demo]).
|
| 22 | +Available map {{PLURAL:$2|service|services}}: $1",
|
| 23 | + 'semanticmaps_lookupcoordinates' => 'Look up coordinates',
|
| 24 | + 'semanticmaps_enteraddresshere' => 'Enter address here',
|
| 25 | + 'semanticmaps_notfound' => 'not found',
|
| 26 | + 'sm_googlemaps_printername' => 'Google Maps',
|
| 27 | + 'sm_yahoomaps_printername' => 'Yahoo! Maps',
|
| 28 | + 'sm_openlayers_printername' => 'OpenLayers',
|
| 29 | +);
|
| 30 | +
|
| 31 | +/** Message documentation (Message documentation)
|
| 32 | + * @author Raymond
|
| 33 | + */
|
| 34 | +$messages['qqq'] = array(
|
| 35 | + 'semanticmaps_desc' => '{{desc}}
|
| 36 | +
|
| 37 | +* $1: a list of available map services',
|
| 38 | + 'sm_googlemaps_printername' => '{{optional}}',
|
| 39 | + 'sm_yahoomaps_printername' => '{{optional}}',
|
| 40 | + 'sm_openlayers_printername' => '{{optional}}',
|
| 41 | +);
|
| 42 | +
|
| 43 | +/** Afrikaans (Afrikaans)
|
| 44 | + * @author Naudefj
|
| 45 | + */
|
| 46 | +$messages['af'] = array(
|
| 47 | + 'semanticmaps_lookupcoordinates' => 'Soek koördinate op',
|
| 48 | +);
|
| 49 | +
|
| 50 | +/** Arabic (العربية)
|
| 51 | + * @author Meno25
|
| 52 | + * @author OsamaK
|
| 53 | + */
|
| 54 | +$messages['ar'] = array(
|
| 55 | + 'semanticmaps_desc' => 'يقدم إمكانية عرض وتعديل بيانات التنسيق التي خزنها امتداد Semantic MediaWiki. خدمات الخرائط المتوفرة: $1',
|
| 56 | + 'semanticmaps_lookupcoordinates' => 'ابحث عن الإحداثيات',
|
| 57 | + 'semanticmaps_enteraddresshere' => 'أدخل العنوان هنا',
|
| 58 | + 'semanticmaps_notfound' => 'لم يوجد',
|
| 59 | +);
|
| 60 | +
|
| 61 | +/** Egyptian Spoken Arabic (مصرى)
|
| 62 | + * @author Ghaly
|
| 63 | + * @author Meno25
|
| 64 | + */
|
| 65 | +$messages['arz'] = array(
|
| 66 | + 'semanticmaps_lookupcoordinates' => 'ابحث عن الإحداثيات',
|
| 67 | + 'semanticmaps_enteraddresshere' => 'أدخل العنوان هنا',
|
| 68 | +);
|
| 69 | +
|
| 70 | +/** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца))
|
| 71 | + * @author EugeneZelenko
|
| 72 | + * @author Jim-by
|
| 73 | + */
|
| 74 | +$messages['be-tarask'] = array(
|
| 75 | + 'semanticmaps_name' => 'Сэмантычныя мапы',
|
| 76 | + 'semanticmaps_desc' => 'Забясьпечвае магчымасьць прагляду і рэдагаваньня зьвестак пра каардынаты, якія захоўваюцца з дапамогай пашырэньня Semantic MediaWiki ([http://wiki.bn2vs.com/wiki/Semantic_Maps дэманстрацыя]). Даступныя сэрвісы мапаў: $1',
|
| 77 | + 'semanticmaps_lookupcoordinates' => 'Пошук каардынатаў',
|
| 78 | + 'semanticmaps_enteraddresshere' => 'Увядзіце тут адрас',
|
| 79 | + 'semanticmaps_notfound' => 'ня знойдзена',
|
| 80 | +);
|
| 81 | +
|
| 82 | +/** Breton (Brezhoneg)
|
| 83 | + * @author Fulup
|
| 84 | + */
|
| 85 | +$messages['br'] = array(
|
| 86 | + 'semanticmaps_desc' => 'Talvezout a ra da welet ha da gemmañ roadennoù stoket dre an astenn Semantic MediaWiki ([http://wiki.bn2vs.com/wiki/Semantic_Maps demo]). Servijoù kartennoù hegerz : $1',
|
| 87 | + 'semanticmaps_lookupcoordinates' => 'Istimañ an daveennoù',
|
| 88 | + 'semanticmaps_enteraddresshere' => "Merkit ar chomlec'h amañ",
|
| 89 | + 'semanticmaps_notfound' => "N'eo ket bet kavet",
|
| 90 | +);
|
| 91 | +
|
| 92 | +/** Bosnian (Bosanski)
|
| 93 | + * @author CERminator
|
| 94 | + */
|
| 95 | +$messages['bs'] = array(
|
| 96 | + 'semanticmaps_desc' => 'Daje mogućnost pregleda i uređivanja podataka koordinata koji su spremljeni putem Semantic MediaWiki proširenja. Dostupne usluge mapa: $1',
|
| 97 | + 'semanticmaps_lookupcoordinates' => 'Nađi koordinate',
|
| 98 | + 'semanticmaps_enteraddresshere' => 'Unesite adresu ovdje',
|
| 99 | + 'semanticmaps_notfound' => 'nije pronađeno',
|
| 100 | +);
|
| 101 | +
|
| 102 | +/** Catalan (Català)
|
| 103 | + * @author Paucabot
|
| 104 | + */
|
| 105 | +$messages['ca'] = array(
|
| 106 | + 'semanticmaps_notfound' => "no s'ha trobat",
|
| 107 | +);
|
| 108 | +
|
| 109 | +/** German (Deutsch)
|
| 110 | + * @author DaSch
|
| 111 | + * @author Pill
|
| 112 | + * @author Umherirrender
|
| 113 | + */
|
| 114 | +$messages['de'] = array(
|
| 115 | + 'semanticmaps_desc' => 'Ergänzt eine Möglichkeit zum Ansehen und Bearbeiten von Koordinaten, die im Rahmen der Erweiterung „Semantisches MediaWiki“ gespeichert wurden ([http://wiki.bn2vs.com/wiki/Semantic_Maps Demo]).
|
| 116 | +Unterstützte Kartendienste: $1',
|
| 117 | + 'semanticmaps_lookupcoordinates' => 'Koordinaten nachschlagen',
|
| 118 | + 'semanticmaps_enteraddresshere' => 'Adresse hier eingeben',
|
| 119 | + 'semanticmaps_notfound' => 'nicht gefunden',
|
| 120 | +);
|
| 121 | +
|
| 122 | +/** Lower Sorbian (Dolnoserbski)
|
| 123 | + * @author Michawiki
|
| 124 | + */
|
| 125 | +$messages['dsb'] = array(
|
| 126 | + 'semanticmaps_desc' => 'Bitujo zmóžnosć se koordinatowe daty pśez rozšyrjenje Semantic MediaWiki woglědaś a wobźěłaś ([http://wiki.bn2vs.com/wiki/Semantic_Maps demo]).
|
| 127 | +K dispoziciji stojece kórtowe słužby: $1.',
|
| 128 | + 'semanticmaps_lookupcoordinates' => 'Za koordinatami póglědaś',
|
| 129 | + 'semanticmaps_enteraddresshere' => 'Zapódaj how adresu',
|
| 130 | + 'semanticmaps_notfound' => 'njenamakany',
|
| 131 | +);
|
| 132 | +
|
| 133 | +/** Greek (Ελληνικά)
|
| 134 | + * @author ZaDiak
|
| 135 | + */
|
| 136 | +$messages['el'] = array(
|
| 137 | + 'semanticmaps_lookupcoordinates' => 'Επιθεώρηση συντεταγμένων',
|
| 138 | + 'semanticmaps_enteraddresshere' => 'Εισαγωγή διεύθυνσης εδώ',
|
| 139 | + 'semanticmaps_notfound' => 'δεν βρέθηκε',
|
| 140 | +);
|
| 141 | +
|
| 142 | +/** Esperanto (Esperanto)
|
| 143 | + * @author Yekrats
|
| 144 | + */
|
| 145 | +$messages['eo'] = array(
|
| 146 | + 'semanticmaps_lookupcoordinates' => 'Rigardi koordinatojn',
|
| 147 | +);
|
| 148 | +
|
| 149 | +/** Spanish (Español)
|
| 150 | + * @author Crazymadlover
|
| 151 | + * @author Imre
|
| 152 | + */
|
| 153 | +$messages['es'] = array(
|
| 154 | + 'semanticmaps_lookupcoordinates' => 'Busque las coordenadas',
|
| 155 | + 'semanticmaps_enteraddresshere' => 'Ingresar dirección aquí',
|
| 156 | + 'semanticmaps_notfound' => 'no encontrado',
|
| 157 | +);
|
| 158 | +
|
| 159 | +/** Basque (Euskara)
|
| 160 | + * @author An13sa
|
| 161 | + */
|
| 162 | +$messages['eu'] = array(
|
| 163 | + 'semanticmaps_lookupcoordinates' => 'Koordenatuak bilatu',
|
| 164 | +);
|
| 165 | +
|
| 166 | +/** Finnish (Suomi)
|
| 167 | + * @author Str4nd
|
| 168 | + */
|
| 169 | +$messages['fi'] = array(
|
| 170 | + 'semanticmaps_notfound' => 'ei löytynyt',
|
| 171 | +);
|
| 172 | +
|
| 173 | +/** French (Français)
|
| 174 | + * @author Crochet.david
|
| 175 | + * @author Grondin
|
| 176 | + * @author IAlex
|
| 177 | + */
|
| 178 | +$messages['fr'] = array(
|
| 179 | + 'semanticmaps_desc' => "Permet de voir et modifier les données de coordonnées stockées à travers l'extension Semantic MediaWiki. Services de cartes disponibles : $1. [http://www.mediawiki.org/wiki/Extension:Semantic_Maps Documentation]. [http://wiki.bn2vs.com/wiki/Semantic_Maps Démo]",
|
| 180 | + 'semanticmaps_lookupcoordinates' => 'Estimer les coordonnées',
|
| 181 | + 'semanticmaps_enteraddresshere' => 'Entrez ici l’adresse',
|
| 182 | + 'semanticmaps_notfound' => 'pas trouvé',
|
| 183 | +);
|
| 184 | +
|
| 185 | +/** Galician (Galego)
|
| 186 | + * @author Toliño
|
| 187 | + */
|
| 188 | +$messages['gl'] = array(
|
| 189 | + 'semanticmaps_desc' => 'Proporciona a capacidade de visualizar e modificar os datos de coordenadas gardados a través da extensión Semantic MediaWiki. Servizos de mapa dispoñibles: $1',
|
| 190 | + 'semanticmaps_lookupcoordinates' => 'Ver as coordenadas',
|
| 191 | + 'semanticmaps_enteraddresshere' => 'Introduza o enderezo aquí',
|
| 192 | + 'semanticmaps_notfound' => 'non se atopou',
|
| 193 | +);
|
| 194 | +
|
| 195 | +/** Swiss German (Alemannisch)
|
| 196 | + * @author Als-Holder
|
| 197 | + */
|
| 198 | +$messages['gsw'] = array(
|
| 199 | + 'semanticmaps_desc' => 'Ergänzt e Megligkeit zum Aaluege un Bearbeite vu Koordinate, wu im Ramme vu dr Erwyterig „Semantisch MediaWiki“ gspycheret wore sin. Unterstitzti Chartedienscht: $1. [http://www.mediawiki.org/wiki/Extension:Semantic_Maps Dokumäntation]. [http://wiki.bn2vs.com/wiki/Semantic_Maps Demo]',
|
| 200 | + 'semanticmaps_lookupcoordinates' => 'Koordinate nooluege',
|
| 201 | + 'semanticmaps_enteraddresshere' => 'Doo Adräss yygee',
|
| 202 | + 'semanticmaps_notfound' => 'nit gfunde',
|
| 203 | +);
|
| 204 | +
|
| 205 | +/** Hebrew (עברית)
|
| 206 | + * @author Rotemliss
|
| 207 | + * @author YaronSh
|
| 208 | + */
|
| 209 | +$messages['he'] = array(
|
| 210 | + 'semanticmaps_lookupcoordinates' => 'חיפוש קואורדינטות',
|
| 211 | + 'semanticmaps_enteraddresshere' => 'כתבו כתובת כאן',
|
| 212 | +);
|
| 213 | +
|
| 214 | +/** Upper Sorbian (Hornjoserbsce)
|
| 215 | + * @author Michawiki
|
| 216 | + */
|
| 217 | +$messages['hsb'] = array(
|
| 218 | + 'semanticmaps_desc' => 'Skići móžnosć koordinatowe daty, kotrež buchu přez rozšěrjenje Semantic MediaWiki składowane, sej wobhladać a změnić. ([http://wiki.bn2vs.com/wiki/Semantic_Maps demo]). K dispoziciji stejace kartowe słužby: $1',
|
| 219 | + 'semanticmaps_lookupcoordinates' => 'Za koordinatami hladać',
|
| 220 | + 'semanticmaps_enteraddresshere' => 'Zapodaj tu adresu',
|
| 221 | + 'semanticmaps_notfound' => 'njenamakany',
|
| 222 | +);
|
| 223 | +
|
| 224 | +/** Interlingua (Interlingua)
|
| 225 | + * @author McDutchie
|
| 226 | + */
|
| 227 | +$messages['ia'] = array(
|
| 228 | + 'semanticmaps_lookupcoordinates' => 'Cercar coordinatas',
|
| 229 | + 'semanticmaps_enteraddresshere' => 'Entra adresse hic',
|
| 230 | +);
|
| 231 | +
|
| 232 | +/** Indonesian (Bahasa Indonesia)
|
| 233 | + * @author Bennylin
|
| 234 | + */
|
| 235 | +$messages['id'] = array(
|
| 236 | + 'semanticmaps_desc' => 'Memampukan penampilan dan penyuntingan data koordinat yang disimpan melalui pengaya MediaWiki Semantic ([http://wiki.bn2vs.com/wiki/Semantic_Maps demo]).
|
| 237 | +Layanan peta yang tersedia: $1',
|
| 238 | + 'semanticmaps_lookupcoordinates' => 'Cari koordinat',
|
| 239 | + 'semanticmaps_enteraddresshere' => 'Masukkan alamat di sini',
|
| 240 | + 'semanticmaps_notfound' => 'tidak ditemukan',
|
| 241 | +);
|
| 242 | +
|
| 243 | +/** Italian (Italiano)
|
| 244 | + * @author Darth Kule
|
| 245 | + */
|
| 246 | +$messages['it'] = array(
|
| 247 | + 'semanticmaps_desc' => "Offre la possibilità di visualizzare e modificare le coordinate memorizzate attraverso l'estensione Semantic MediaWiki ([http://wiki.bn2vs.com/wiki/Semantic_Maps demo]). Servizi di mappe disponibili: $1",
|
| 248 | + 'semanticmaps_lookupcoordinates' => 'Cerca coordinate',
|
| 249 | + 'semanticmaps_enteraddresshere' => 'Inserisci indirizzo qui',
|
| 250 | + 'semanticmaps_notfound' => 'non trovato',
|
| 251 | +);
|
| 252 | +
|
| 253 | +/** Japanese (日本語)
|
| 254 | + * @author Fryed-peach
|
| 255 | + * @author Mizusumashi
|
| 256 | + */
|
| 257 | +$messages['ja'] = array(
|
| 258 | + 'semanticmaps_desc' => 'Semantic MediaWiki 拡張機能を通して格納された座標データを表示・編集する機能を提供する([http://wiki.bn2vs.com/wiki/Semantic_Maps 実演])。次の地図サービスに対応します:$1',
|
| 259 | + 'semanticmaps_lookupcoordinates' => '座標を調べる',
|
| 260 | + 'semanticmaps_enteraddresshere' => '住所をここに入力します',
|
| 261 | + 'semanticmaps_notfound' => '見つかりません',
|
| 262 | +);
|
| 263 | +
|
| 264 | +/** Khmer (ភាសាខ្មែរ)
|
| 265 | + * @author Thearith
|
| 266 | + */
|
| 267 | +$messages['km'] = array(
|
| 268 | + 'semanticmaps_lookupcoordinates' => 'ក្រឡេកមើលកូអរដោនេ',
|
| 269 | +);
|
| 270 | +
|
| 271 | +/** Ripoarisch (Ripoarisch)
|
| 272 | + * @author Purodha
|
| 273 | + */
|
| 274 | +$messages['ksh'] = array(
|
| 275 | + 'semanticmaps_desc' => 'Määt et müjjelesch, Koodinaate ze beloore un ze ändere, di per Semantesch Mediawiki faßjehallde woodte. (E [http://wiki.bn2vs.com/wiki/Semantic_Maps Beijshpöll]) Deenste för Kaate ham_mer di heh: $1',
|
| 276 | + 'semanticmaps_lookupcoordinates' => 'Koordinate nohkike',
|
| 277 | + 'semanticmaps_enteraddresshere' => 'Donn hee de Address enjäve',
|
| 278 | + 'semanticmaps_notfound' => 'nit jefonge',
|
| 279 | +);
|
| 280 | +
|
| 281 | +/** Luxembourgish (Lëtzebuergesch)
|
| 282 | + * @author Robby
|
| 283 | + */
|
| 284 | +$messages['lb'] = array(
|
| 285 | + 'semanticmaps_lookupcoordinates' => 'Koordinaten nokucken',
|
| 286 | + 'semanticmaps_enteraddresshere' => 'Adress hei aginn',
|
| 287 | + 'semanticmaps_notfound' => 'net fonnt',
|
| 288 | +);
|
| 289 | +
|
| 290 | +/** Macedonian (Македонски)
|
| 291 | + * @author Bjankuloski06
|
| 292 | + */
|
| 293 | +$messages['mk'] = array(
|
| 294 | + 'semanticmaps_desc' => 'Дава можност за гледање и уредување на податоци со координати складирани преку проширувањето Semantic MediaWiki ([http://wiki.bn2vs.com/wiki/Semantic_Maps демо]).
|
| 295 | +Картографски служби на располагање: $1',
|
| 296 | + 'semanticmaps_lookupcoordinates' => 'Побарај координати',
|
| 297 | + 'semanticmaps_enteraddresshere' => 'Внесете адреса тука',
|
| 298 | + 'semanticmaps_notfound' => 'не е најдено ништо',
|
| 299 | +);
|
| 300 | +
|
| 301 | +/** Dutch (Nederlands)
|
| 302 | + * @author Jeroen De Dauw
|
| 303 | + * @author Siebrand
|
| 304 | + */
|
| 305 | +$messages['nl'] = array(
|
| 306 | + 'semanticmaps_desc' => 'Biedt de mogelijkheid om locatiegegevens die zijn opgeslagen met behulp van de uitbreiding Semantic MediaWiki te bekijken en aan te passen ([http://wiki.bn2vs.com/wiki/Semantic_Maps demo]).
|
| 307 | +Beschikbare {{PLURAL:$2|kaartdienst|kaartdiensten}}: $1',
|
| 308 | + 'semanticmaps_lookupcoordinates' => 'Coördinaten opzoeken',
|
| 309 | + 'semanticmaps_enteraddresshere' => 'Voer hier het adres in',
|
| 310 | + 'semanticmaps_notfound' => 'niet gevonden',
|
| 311 | +);
|
| 312 | +
|
| 313 | +/** Norwegian Nynorsk (Norsk (nynorsk))
|
| 314 | + * @author Harald Khan
|
| 315 | + */
|
| 316 | +$messages['nn'] = array(
|
| 317 | + 'semanticmaps_lookupcoordinates' => 'Sjekk koordinatar',
|
| 318 | + 'semanticmaps_enteraddresshere' => 'Skriv inn adressa her',
|
| 319 | +);
|
| 320 | +
|
| 321 | +/** Norwegian (bokmål) (Norsk (bokmål))
|
| 322 | + * @author Jon Harald Søby
|
| 323 | + * @author Nghtwlkr
|
| 324 | + */
|
| 325 | +$messages['no'] = array(
|
| 326 | + 'semanticmaps_lookupcoordinates' => 'Sjekk koordinater',
|
| 327 | + 'semanticmaps_enteraddresshere' => 'Skriv inn adressen her',
|
| 328 | +);
|
| 329 | +
|
| 330 | +/** Occitan (Occitan)
|
| 331 | + * @author Cedric31
|
| 332 | + */
|
| 333 | +$messages['oc'] = array(
|
| 334 | + 'semanticmaps_desc' => "Permet de veire e modificar las donadas de coordenadas estocadas a travèrs l'extension Semantic MediaWiki. Servicis de mapas disponibles : $1. [http://www.mediawiki.org/wiki/Extension:Semantic_Maps Documentacion]. [http://wiki.bn2vs.com/wiki/Semantic_Maps Demo]",
|
| 335 | + 'semanticmaps_lookupcoordinates' => 'Estimar las coordenadas',
|
| 336 | + 'semanticmaps_enteraddresshere' => 'Picatz aicí l’adreça',
|
| 337 | + 'semanticmaps_notfound' => 'pas trobat',
|
| 338 | +);
|
| 339 | +
|
| 340 | +/** Polish (Polski)
|
| 341 | + * @author Derbeth
|
| 342 | + * @author Leinad
|
| 343 | + * @author Sp5uhe
|
| 344 | + */
|
| 345 | +$messages['pl'] = array(
|
| 346 | + 'semanticmaps_desc' => 'Daje możliwość przeglądania oraz edytowania współrzędnych zapisanych przez rozszerzenie Semantic MediaWiki ([http://wiki.bn2vs.com/wiki/Semantic_Maps demo]).
|
| 347 | +Dostępne serwisy mapowe: $1',
|
| 348 | + 'semanticmaps_lookupcoordinates' => 'Wyszukaj współrzędne',
|
| 349 | + 'semanticmaps_enteraddresshere' => 'Podaj adres',
|
| 350 | + 'semanticmaps_notfound' => 'nie odnaleziono',
|
| 351 | +);
|
| 352 | +
|
| 353 | +/** Portuguese (Português)
|
| 354 | + * @author Malafaya
|
| 355 | + */
|
| 356 | +$messages['pt'] = array(
|
| 357 | + 'semanticmaps_lookupcoordinates' => 'Pesquisar coordenadas',
|
| 358 | + 'semanticmaps_enteraddresshere' => 'Introduza um endereço aqui',
|
| 359 | +);
|
| 360 | +
|
| 361 | +/** Brazilian Portuguese (Português do Brasil)
|
| 362 | + * @author Eduardo.mps
|
| 363 | + */
|
| 364 | +$messages['pt-br'] = array(
|
| 365 | + 'semanticmaps_desc' => 'Provê a possibilidade de ver e editar dados de coordenadas armazenados através da extensão Semantic MediaWiki. ([http://wiki.bn2vs.com/wiki/Semantic_Maps demonstração]).
|
| 366 | +Serviços de mapeamento disponíveis: $1',
|
| 367 | + 'semanticmaps_lookupcoordinates' => 'Pesquisar coordenadas',
|
| 368 | + 'semanticmaps_enteraddresshere' => 'Introduza um endereço aqui',
|
| 369 | + 'semanticmaps_notfound' => 'Não encontrado',
|
| 370 | +);
|
| 371 | +
|
| 372 | +/** Romanian (Română)
|
| 373 | + * @author Firilacroco
|
| 374 | + */
|
| 375 | +$messages['ro'] = array(
|
| 376 | + 'semanticmaps_notfound' => 'nu a fost găsit',
|
| 377 | +);
|
| 378 | +
|
| 379 | +/** Tarandíne (Tarandíne)
|
| 380 | + * @author Joetaras
|
| 381 | + */
|
| 382 | +$messages['roa-tara'] = array(
|
| 383 | + 'semanticmaps_desc' => "Dè l'abbilità a fà vedè e cangià le coordinate reggistrate cu l'estenzione Semandiche de MediaUicchi ([http://wiki.bn2vs.com/wiki/Semantic_Maps demo]).
|
| 384 | +Disponibbile le servizie de mappe: $1",
|
| 385 | + 'semanticmaps_lookupcoordinates' => 'Ingroce le coordinate',
|
| 386 | + 'semanticmaps_enteraddresshere' => "Scaffe l'indirizze aqquà",
|
| 387 | + 'semanticmaps_notfound' => 'no acchiate',
|
| 388 | +);
|
| 389 | +
|
| 390 | +/** Russian (Русский)
|
| 391 | + * @author Eugene Mednikov
|
| 392 | + * @author Lockal
|
| 393 | + * @author Александр Сигачёв
|
| 394 | + */
|
| 395 | +$messages['ru'] = array(
|
| 396 | + 'semanticmaps_desc' => 'Предоставляет возможность просмотра и редактирования данных о координатах, хранящихся посредством расширения Semantic MediaWiki ([http://wiki.bn2vs.com/wiki/Semantic_Maps демонстрация]).
|
| 397 | +Доступные службы карт: $1',
|
| 398 | + 'semanticmaps_lookupcoordinates' => 'Найти координаты',
|
| 399 | + 'semanticmaps_enteraddresshere' => 'Введите адрес',
|
| 400 | + 'semanticmaps_notfound' => 'не найдено',
|
| 401 | +);
|
| 402 | +
|
| 403 | +/** Slovak (Slovenčina)
|
| 404 | + * @author Helix84
|
| 405 | + */
|
| 406 | +$messages['sk'] = array(
|
| 407 | + 'semanticmaps_desc' => 'Poskytuje schopnosť zobrazovať a upravovať údaje súradníc uložené prostredníctvom rozšírenia Semantic MediaWiki ([http://wiki.bn2vs.com/wiki/Semantic_Maps demo]).
|
| 408 | +Dostupné mapové služby: $1',
|
| 409 | + 'semanticmaps_lookupcoordinates' => 'Vyhľadať súradnice',
|
| 410 | + 'semanticmaps_enteraddresshere' => 'Sem zadajte emailovú adresu',
|
| 411 | + 'semanticmaps_notfound' => 'nenájdené',
|
| 412 | +);
|
| 413 | +
|
| 414 | +/** Serbian Cyrillic ekavian (ћирилица)
|
| 415 | + * @author Михајло Анђелковић
|
| 416 | + */
|
| 417 | +$messages['sr-ec'] = array(
|
| 418 | + 'semanticmaps_enteraddresshere' => 'Унеси адресу овде',
|
| 419 | + 'semanticmaps_notfound' => 'није нађено',
|
| 420 | +);
|
| 421 | +
|
| 422 | +/** latinica (latinica)
|
| 423 | + * @author Michaello
|
| 424 | + */
|
| 425 | +$messages['sr-el'] = array(
|
| 426 | + 'semanticmaps_enteraddresshere' => 'Unesi adresu ovde',
|
| 427 | + 'semanticmaps_notfound' => 'nije nađeno',
|
| 428 | +);
|
| 429 | +
|
| 430 | +/** Swedish (Svenska)
|
| 431 | + * @author Boivie
|
| 432 | + * @author Najami
|
| 433 | + */
|
| 434 | +$messages['sv'] = array(
|
| 435 | + 'semanticmaps_lookupcoordinates' => 'Kolla upp koordinater',
|
| 436 | + 'semanticmaps_enteraddresshere' => 'Skriv in adress här',
|
| 437 | +);
|
| 438 | +
|
| 439 | +/** Tagalog (Tagalog)
|
| 440 | + * @author AnakngAraw
|
| 441 | + */
|
| 442 | +$messages['tl'] = array(
|
| 443 | + 'semanticmaps_lookupcoordinates' => "Hanapin ang mga tugmaang-pampook (''coordinate'')",
|
| 444 | + 'semanticmaps_enteraddresshere' => 'Ipasok ang adres dito',
|
| 445 | +);
|
| 446 | +
|
| 447 | +/** Vietnamese (Tiếng Việt)
|
| 448 | + * @author Vinhtantran
|
| 449 | + */
|
| 450 | +$messages['vi'] = array(
|
| 451 | + 'semanticmaps_lookupcoordinates' => 'Tra tọa độ',
|
| 452 | + 'semanticmaps_enteraddresshere' => 'Nhập địa chỉ vào đây',
|
| 453 | +);
|
| 454 | +
|
| 455 | +/** Volapük (Volapük)
|
| 456 | + * @author Smeira
|
| 457 | + */
|
| 458 | +$messages['vo'] = array(
|
| 459 | + 'semanticmaps_lookupcoordinates' => 'Tuvön koordinatis',
|
| 460 | +);
|
| 461 | +
|
| 462 | +/** Simplified Chinese (中文(简体))
|
| 463 | + * @author Gzdavidwong
|
| 464 | + */
|
| 465 | +$messages['zh-hans'] = array(
|
| 466 | + 'semanticmaps_lookupcoordinates' => '查找坐标',
|
| 467 | +);
|
| 468 | +
|
| 469 | +/** Traditional Chinese (中文(繁體))
|
| 470 | + * @author Wrightbus
|
| 471 | + */
|
| 472 | +$messages['zh-hant'] = array(
|
| 473 | + 'semanticmaps_lookupcoordinates' => '尋找座標',
|
| 474 | +);
|
| 475 | +
|
Index: tags/extensions/SemanticMaps/REL_0_3_2/SM_Mapper.php |
— | — | @@ -0,0 +1,43 @@ |
| 2 | +<?php
|
| 3 | +
|
| 4 | +/**
|
| 5 | + * General map query printer class
|
| 6 | + *
|
| 7 | + * @file SM_Mapper.php
|
| 8 | + * @ingroup SemanticMaps
|
| 9 | + *
|
| 10 | + * @author Jeroen De Dauw
|
| 11 | + */
|
| 12 | +
|
| 13 | +if( !defined( 'MEDIAWIKI' ) ) {
|
| 14 | + die( 'Not an entry point.' );
|
| 15 | +}
|
| 16 | +
|
| 17 | +final class SMMapper {
|
| 18 | +
|
| 19 | + private $queryPrinter;
|
| 20 | +
|
| 21 | + public function __construct($format, $inline) {
|
| 22 | + global $egMapsDefaultServices, $egMapsServices;
|
| 23 | +
|
| 24 | + // TODO: allow service parameter to override the default
|
| 25 | + if ($format == 'map') $format = $egMapsDefaultServices['qp'];
|
| 26 | +
|
| 27 | + $service = MapsMapper::getValidService($format, 'qp');
|
| 28 | +
|
| 29 | + $this->queryPrinter = new $egMapsServices[$service]['qp']['class']($format, $inline);
|
| 30 | + }
|
| 31 | +
|
| 32 | + public function getQueryMode($context) {
|
| 33 | + return $this->queryPrinter->getQueryMode($context);
|
| 34 | + }
|
| 35 | +
|
| 36 | + public function getResult($results, $params, $outputmode) {
|
| 37 | + return $this->queryPrinter->getResult($results, $params, $outputmode);
|
| 38 | + }
|
| 39 | +
|
| 40 | + protected function getResultText($res, $outputmode) {
|
| 41 | + return $this->queryPrinter->getResultText($res, $outputmode);
|
| 42 | + }
|
| 43 | +
|
| 44 | +} |
\ No newline at end of file |
Index: tags/extensions/SemanticMaps/REL_0_3_2/SemanticMaps.php |
— | — | @@ -0,0 +1,211 @@ |
| 2 | +<?php
|
| 3 | +
|
| 4 | +/**
|
| 5 | + * Initialization file for the Semantic Maps extension.
|
| 6 | + * Extension documentation: http://www.mediawiki.org/wiki/Extension:Semantic_Maps
|
| 7 | + *
|
| 8 | + * @file SemanticMaps.php
|
| 9 | + * @ingroup SemanticMaps
|
| 10 | + *
|
| 11 | + * @author Jeroen De Dauw
|
| 12 | + */
|
| 13 | +
|
| 14 | +/**
|
| 15 | + * This documenation group collects source code files belonging to Semantic Maps.
|
| 16 | + *
|
| 17 | + * Please do not use this group name for other code. If you have an extension to
|
| 18 | + * Semantic Maps, please use your own group defenition.
|
| 19 | + *
|
| 20 | + * @defgroup SemanticMaps Semantic Maps
|
| 21 | + */
|
| 22 | +
|
| 23 | +if( !defined( 'MEDIAWIKI' ) ) {
|
| 24 | + die( 'Not an entry point.' );
|
| 25 | +}
|
| 26 | +
|
| 27 | +define('SM_VERSION', '0.3.1');
|
| 28 | +
|
| 29 | +$smgScriptPath = $wgScriptPath . '/extensions/SemanticMaps';
|
| 30 | +$smgIP = $IP . '/extensions/SemanticMaps';
|
| 31 | +
|
| 32 | +$wgExtensionFunctions[] = 'smfSetup';
|
| 33 | +
|
| 34 | +$wgHooks['AdminLinks'][] = 'smfAddToAdminLinks';
|
| 35 | +
|
| 36 | +$wgExtensionMessagesFiles['SemanticMaps'] = $smgIP . '/SemanticMaps.i18n.php';
|
| 37 | +
|
| 38 | +// Autoload the general classes
|
| 39 | +$wgAutoloadClasses['SMMapPrinter'] = $smgIP . '/SM_MapPrinter.php';
|
| 40 | +$wgAutoloadClasses['SMMapper'] = $smgIP . '/SM_Mapper.php';
|
| 41 | +$wgAutoloadClasses['SMFormInput'] = $smgIP . '/SM_FormInput.php';
|
| 42 | +
|
| 43 | +// Add the services
|
| 44 | +$egMapsServices['googlemaps']['qp'] = array('class' => 'SMGoogleMaps', 'file' => 'GoogleMaps/SM_GoogleMaps.php', 'local' => true);
|
| 45 | +$egMapsServices['googlemaps']['fi'] = array('class' => 'SMGoogleMapsFormInput', 'file' => 'GoogleMaps/SM_GoogleMapsFormInput.php', 'local' => true);
|
| 46 | +
|
| 47 | +$egMapsServices['yahoomaps']['qp'] = array('class' => 'SMYahooMaps', 'file' => 'YahooMaps/SM_YahooMaps.php', 'local' => true);
|
| 48 | +$egMapsServices['yahoomaps']['fi'] = array('class' => 'SMYahooMapsFormInput', 'file' => 'YahooMaps/SM_YahooMapsFormInput.php', 'local' => true);
|
| 49 | +
|
| 50 | +$egMapsServices['openlayers']['qp'] = array('class' => 'SMOpenLayers', 'file' => 'OpenLayers/SM_OpenLayers.php', 'local' => true);
|
| 51 | +$egMapsServices['openlayers']['fi'] = array('class' => 'SMOpenLayersFormInput', 'file' => 'OpenLayers/SM_OpenLayersFormInput.php', 'local' => true);
|
| 52 | +
|
| 53 | +/**
|
| 54 | + * Initialization function for the Semantic Maps extension
|
| 55 | + *
|
| 56 | + */
|
| 57 | +function smfSetup() {
|
| 58 | + global $wgExtensionCredits, $egMapsServices;
|
| 59 | +
|
| 60 | + $services_list = implode(', ', array_keys($egMapsServices));
|
| 61 | + $services_count = count( $egMapsServices );
|
| 62 | +
|
| 63 | + wfLoadExtensionMessages( 'SemanticMaps' );
|
| 64 | +
|
| 65 | + $wgExtensionCredits['other'][]= array(
|
| 66 | + 'path' => __FILE__,
|
| 67 | + 'name' => wfMsg('semanticmaps_name'),
|
| 68 | + 'version' => SM_VERSION,
|
| 69 | + 'author' => array("[http://bn2vs.com Jeroen De Dauw]", "Yaron Koren", "Robert Buzink"),
|
| 70 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Semantic_Maps',
|
| 71 | + 'description' => wfMsgExt( 'semanticmaps_desc', 'parsemag', $services_list, $services_count ),
|
| 72 | + 'descriptionmsg' => wfMsgExt( 'semanticmaps_desc', 'parsemag', $services_list, $services_count ),
|
| 73 | + );
|
| 74 | +
|
| 75 | + smfInitFormHook('map');
|
| 76 | + smfInitFormat('map', array('class' => 'SMMapper', 'file' => 'SM_Mapper.php', 'local' => true));
|
| 77 | +
|
| 78 | + foreach($egMapsServices as $serviceName => $serviceData) {
|
| 79 | + $hasQP = array_key_exists('qp', $serviceData);
|
| 80 | + $hasFI = array_key_exists('fi', $serviceData);
|
| 81 | +
|
| 82 | + // If the service has no QP and no FI, skipt it and continue with the next one.
|
| 83 | + if (!$hasQP && !$hasFI) continue;
|
| 84 | +
|
| 85 | + // Add the result format and form input type for the service name when needed.
|
| 86 | + if ($hasQP) smfInitFormat($serviceName, $serviceData['qp']);
|
| 87 | + if ($hasFI) smfInitFormHook($serviceName, $serviceData['fi']);
|
| 88 | +
|
| 89 | + // Loop through the service alliases, and add them as result formats and form input types when needed.
|
| 90 | + foreach ($serviceData['aliases'] as $alias) {
|
| 91 | + if ($hasQP) smfInitFormat($alias, $serviceData['qp']);
|
| 92 | + if ($hasFI) smfInitFormHook($alias, $serviceData['fi'], $serviceName);
|
| 93 | + }
|
| 94 | + }
|
| 95 | +
|
| 96 | +}
|
| 97 | +
|
| 98 | +/**
|
| 99 | + * Add the result format for a mapping service or alias
|
| 100 | + *
|
| 101 | + * @param string $format
|
| 102 | + * @param array $qp
|
| 103 | + */
|
| 104 | +function smfInitFormat($format, array $qp) {
|
| 105 | + global $wgAutoloadClasses, $smwgResultFormats, $smgIP;
|
| 106 | +
|
| 107 | + if (! array_key_exists($qp['class'], $wgAutoloadClasses)) {
|
| 108 | + $file = $qp['local'] ? $smgIP . '/' . $qp['file'] : $qp['file'];
|
| 109 | + $wgAutoloadClasses[$qp['class']] = $file;
|
| 110 | + }
|
| 111 | +
|
| 112 | + if (isset($smwgResultFormats)) {
|
| 113 | + $smwgResultFormats[$format] = $qp['class'];
|
| 114 | + }
|
| 115 | + else {
|
| 116 | + SMWQueryProcessor::$formats[$format] = $qp['class'];
|
| 117 | + }
|
| 118 | +}
|
| 119 | +
|
| 120 | +/**
|
| 121 | + * Adds a mapping service's form hook
|
| 122 | + *
|
| 123 | + * @param string $service
|
| 124 | + * @param array $fi
|
| 125 | + * @param strig $mainName
|
| 126 | + */
|
| 127 | +function smfInitFormHook($service, array $fi = null, $mainName = '') {
|
| 128 | + global $wgAutoloadClasses, $sfgFormPrinter, $smgIP;
|
| 129 | +
|
| 130 | + if (isset($fi)) {
|
| 131 | + if (! array_key_exists($fi['class'], $wgAutoloadClasses)) {
|
| 132 | + $file = $fi['local'] ? $smgIP . '/' . $fi['file'] : $fi['file'];
|
| 133 | + $wgAutoloadClasses[$fi['class']] = $file;
|
| 134 | + }
|
| 135 | + }
|
| 136 | +
|
| 137 | + // Add the form input hook for the service
|
| 138 | + $field_args = array();
|
| 139 | + if (strlen($mainName) > 0) $field_args['service_name'] = $mainName;
|
| 140 | + $sfgFormPrinter->setInputTypeHook($service, 'smfSelectFormInputHTML', $field_args);
|
| 141 | +}
|
| 142 | +
|
| 143 | +/**
|
| 144 | + * Class for the form input type 'map'. The relevant form input class is called depending on the provided service.
|
| 145 | + *
|
| 146 | + * @param unknown_type $coordinates
|
| 147 | + * @param unknown_type $input_name
|
| 148 | + * @param unknown_type $is_mandatory
|
| 149 | + * @param unknown_type $is_disabled
|
| 150 | + * @param array $field_args
|
| 151 | + * @return unknown
|
| 152 | + */
|
| 153 | +function smfSelectFormInputHTML($coordinates, $input_name, $is_mandatory, $is_disabled, array $field_args) {
|
| 154 | + global $egMapsServices;
|
| 155 | +
|
| 156 | + // If service_name is set, use this value, and ignore any given
|
| 157 | + // service parameters
|
| 158 | + // This will prevent ..input type=googlemaps|service=yahoo.. from
|
| 159 | + // showing up as a Yahoo! Maps map
|
| 160 | + if (array_key_exists('service_name', $field_args)) {
|
| 161 | + $service_name = $field_args['service_name'];
|
| 162 | + }
|
| 163 | + elseif (array_key_exists('service', $field_args)) {
|
| 164 | + $service_name = $field_args['service'];
|
| 165 | + }
|
| 166 | + else{
|
| 167 | + $service_name = null;
|
| 168 | + }
|
| 169 | +
|
| 170 | + $service_name = MapsMapper::getValidService($service_name, 'fi');
|
| 171 | +
|
| 172 | + if (array_key_exists('fi', $egMapsServices[$service_name])) {
|
| 173 | + $formInput = new $egMapsServices[$service_name]['fi']['class']();
|
| 174 | +
|
| 175 | + // Get and return the form input HTML from the hook corresponding with the provided service
|
| 176 | + return $formInput->formInputHTML($coordinates, $input_name, $is_mandatory, $is_disabled, $field_args);
|
| 177 | + }
|
| 178 | + else {
|
| 179 | + return "<b>ERROR: Form input for ".$field_args['service']." not found</b>";
|
| 180 | + }
|
| 181 | +
|
| 182 | +}
|
| 183 | +
|
| 184 | +/**
|
| 185 | + * Returns html for an html input field with a default value that will automatically dissapear when
|
| 186 | + * the user clicks in it, and reappers when the focus on the field is lost and it's still empty.
|
| 187 | + *
|
| 188 | + * @param string $id
|
| 189 | + * @param string $value
|
| 190 | + * @param string $args
|
| 191 | + * @return html
|
| 192 | + */
|
| 193 | +function smfGetDynamicInput($id, $value, $args='') {
|
| 194 | + // By De Dauw Jeroen - November 2008 - http://code.bn2vs.com/viewtopic.php?t=120
|
| 195 | + return '<input id="'.$id.'" '.$args.' value="'.$value.'" onfocus="if (this.value==\''.$value.'\') {this.value=\'\';}" onblur="if (this.value==\'\') {this.value=\''.$value.'\';}" />';
|
| 196 | +}
|
| 197 | +
|
| 198 | +/**
|
| 199 | + * Adds a link to Admin Links page
|
| 200 | + */
|
| 201 | +function smfAddToAdminLinks(&$admin_links_tree) {
|
| 202 | + $displaying_data_section = $admin_links_tree->getSection(wfMsg('smw_adminlinks_displayingdata'));
|
| 203 | + // Escape if SMW hasn't added links
|
| 204 | + if (is_null($displaying_data_section))
|
| 205 | + return true;
|
| 206 | + $smw_docu_row = $displaying_data_section->getRow('smw');
|
| 207 | + wfLoadExtensionMessages('SemanticMaps');
|
| 208 | + $sm_docu_label = wfMsg('adminlinks_documentation', wfMsg('semanticmaps_name'));
|
| 209 | + $smw_docu_row->addItem(AlItem::newFromExternalLink("http://www.mediawiki.org/wiki/Extension:Semantic_Maps", $sm_docu_label));
|
| 210 | + return true;
|
| 211 | +}
|
| 212 | +
|
Index: tags/extensions/SemanticMaps/REL_0_3_2/GoogleMaps/SM_GoogleMaps.php |
— | — | @@ -0,0 +1,105 @@ |
| 2 | +<?php
|
| 3 | +/**
|
| 4 | + * A query printer for maps using the Google Maps API
|
| 5 | + *
|
| 6 | + * @file SM_GoogleMaps.php
|
| 7 | + * @ingroup SemanticMaps
|
| 8 | + *
|
| 9 | + * @author Robert Buzink
|
| 10 | + * @author Yaron Koren
|
| 11 | + * @author Jeroen De Dauw
|
| 12 | + */
|
| 13 | +
|
| 14 | +if( !defined( 'MEDIAWIKI' ) ) {
|
| 15 | + die( 'Not an entry point.' );
|
| 16 | +}
|
| 17 | +
|
| 18 | +final class SMGoogleMaps extends SMMapPrinter {
|
| 19 | +
|
| 20 | + public $serviceName = MapsGoogleMaps::SERVICE_NAME;
|
| 21 | +
|
| 22 | + public function getName() {
|
| 23 | + wfLoadExtensionMessages('SemanticMaps');
|
| 24 | + return wfMsg('sm_googlemaps_printername');
|
| 25 | + }
|
| 26 | +
|
| 27 | + /**
|
| 28 | + * @see SMMapPrinter::setQueryPrinterSettings()
|
| 29 | + *
|
| 30 | + */
|
| 31 | + protected function setQueryPrinterSettings() {
|
| 32 | + global $egMapsGoogleMapsZoom, $egMapsGoogleMapsPrefix;
|
| 33 | +
|
| 34 | + $this->elementNamePrefix = $egMapsGoogleMapsPrefix;
|
| 35 | +
|
| 36 | + $this->defaultZoom = $egMapsGoogleMapsZoom;
|
| 37 | +
|
| 38 | + $this->defaultParams = MapsGoogleMapsUtils::getDefaultParams();
|
| 39 | + }
|
| 40 | +
|
| 41 | + /**
|
| 42 | + * @see SMMapPrinter::doMapServiceLoad()
|
| 43 | + *
|
| 44 | + */
|
| 45 | + protected function doMapServiceLoad() {
|
| 46 | + global $egGoogleMapsOnThisPage;
|
| 47 | +
|
| 48 | + if (empty($egGoogleMapsOnThisPage)) {
|
| 49 | + $egGoogleMapsOnThisPage = 0;
|
| 50 | + MapsGoogleMapsUtils::addGMapDependencies($this->output);
|
| 51 | + }
|
| 52 | +
|
| 53 | + $egGoogleMapsOnThisPage++;
|
| 54 | +
|
| 55 | + $this->elementNr = $egGoogleMapsOnThisPage;
|
| 56 | + }
|
| 57 | +
|
| 58 | + /**
|
| 59 | + * @see SMMapPrinter::getQueryResult()
|
| 60 | + *
|
| 61 | + */
|
| 62 | + protected function addSpecificMapHTML() {
|
| 63 | + global $wgJsMimeType;
|
| 64 | +
|
| 65 | + $enableEarth = MapsGoogleMapsUtils::getEarthValue($this->earth);
|
| 66 | +
|
| 67 | + // Get the Google Maps names for the control and map types
|
| 68 | + $this->type = MapsGoogleMapsUtils::getGMapType($this->type, true);
|
| 69 | +
|
| 70 | + $this->controls = MapsGoogleMapsUtils::createControlsString($this->controls);
|
| 71 | +
|
| 72 | + $this->autozoom = MapsGoogleMapsUtils::getAutozoomJSValue($this->autozoom);
|
| 73 | +
|
| 74 | + $markerItems = array();
|
| 75 | +
|
| 76 | + foreach ($this->m_locations as $location) {
|
| 77 | + // Create a string containing the marker JS
|
| 78 | + list($lat, $lon, $title, $label, $icon) = $location;
|
| 79 | +
|
| 80 | + $title = str_replace("'", "\'", $title);
|
| 81 | + $label = str_replace("'", "\'", $label);
|
| 82 | +
|
| 83 | + $markerItems[] = "getGMarkerData($lat, $lon, '$title', '$label', '$icon')";
|
| 84 | + }
|
| 85 | +
|
| 86 | + $markersString = implode(',', $markerItems);
|
| 87 | +
|
| 88 | + $this->types = explode(",", $this->types);
|
| 89 | +
|
| 90 | + $typesString = MapsGoogleMapsUtils::createTypesString($this->types, $enableEarth);
|
| 91 | +
|
| 92 | + $this->output .= <<<END
|
| 93 | +<div id="$this->mapName" class="$this->class" style="$this->style" ></div>
|
| 94 | +<script type="$wgJsMimeType"> /*<![CDATA[*/
|
| 95 | +addLoadEvent(
|
| 96 | + initializeGoogleMap('$this->mapName', $this->width, $this->height, $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$typesString], [$this->controls], $this->autozoom, [$markersString])
|
| 97 | +);
|
| 98 | +/*]]>*/ </script>
|
| 99 | +
|
| 100 | +END;
|
| 101 | +
|
| 102 | + }
|
| 103 | +
|
| 104 | +
|
| 105 | +}
|
| 106 | +
|
Index: tags/extensions/SemanticMaps/REL_0_3_2/GoogleMaps/SM_GoogleMapsFormInput.php |
— | — | @@ -0,0 +1,94 @@ |
| 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 SemanticMaps
|
| 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->defaultParams = MapsGoogleMapsUtils::getDefaultParams(); |
| 36 | + $this->defaultZoom = $egMapsGoogleMapsZoom; |
| 37 | + } |
| 38 | + |
| 39 | + |
| 40 | + /** |
| 41 | + * @see MapsMapFeature::doMapServiceLoad() |
| 42 | + * |
| 43 | + */ |
| 44 | + protected function doMapServiceLoad() { |
| 45 | + global $egGoogleMapsOnThisPage; |
| 46 | + |
| 47 | + if (empty($egGoogleMapsOnThisPage)) { |
| 48 | + $egGoogleMapsOnThisPage = 0; |
| 49 | + MapsGoogleMapsUtils::addGMapDependencies($this->output); |
| 50 | + } |
| 51 | + |
| 52 | + $egGoogleMapsOnThisPage++; |
| 53 | + |
| 54 | + $this->elementNr = $egGoogleMapsOnThisPage; |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * @see MapsMapFeature::addSpecificFormInputHTML() |
| 59 | + * |
| 60 | + */ |
| 61 | + protected function addSpecificMapHTML() { |
| 62 | + global $wgJsMimeType; |
| 63 | + |
| 64 | + $enableEarth = MapsGoogleMapsUtils::getEarthValue($this->earth); |
| 65 | + |
| 66 | + $this->autozoom = MapsGoogleMapsUtils::getAutozoomJSValue($this->autozoom); |
| 67 | + |
| 68 | + $this->type = MapsGoogleMapsUtils::getGMapType($this->type, true); |
| 69 | + |
| 70 | + $this->controls = MapsGoogleMapsUtils::createControlsString($this->controls); |
| 71 | + |
| 72 | + $this->types = explode(",", $this->types); |
| 73 | + |
| 74 | + $typesString = MapsGoogleMapsUtils::createTypesString($this->types, $enableEarth); |
| 75 | + |
| 76 | + $this->output .= " |
| 77 | + <div id='".$this->mapName."' class='".$this->class."'></div> |
| 78 | + |
| 79 | + <script type='$wgJsMimeType'>/*<![CDATA[*/ |
| 80 | + addLoadEvent(makeFormInputGoogleMap('$this->mapName', '$this->coordsFieldName', $this->width, $this->height, $this->centre_lat, $this->centre_lon, $this->zoom, $this->type, [$typesString], [$this->controls], $this->autozoom, $this->marker_lat, $this->marker_lon)); |
| 81 | + window.unload = GUnload; |
| 82 | + /*]]>*/</script>"; |
| 83 | + } |
| 84 | + |
| 85 | + /** |
| 86 | + * @see SMFormInput::manageGeocoding() |
| 87 | + * |
| 88 | + */ |
| 89 | + protected function manageGeocoding() { |
| 90 | + global $egGoogleMapsKey; |
| 91 | + $this->enableGeocoding = strlen(trim($egGoogleMapsKey)) > 0; |
| 92 | + if ($this->enableGeocoding) MapsGoogleMapsUtils::addGMapDependencies($this->output); |
| 93 | + }
|
| 94 | + |
| 95 | +} |
Index: tags/extensions/SemanticMaps/REL_0_3_2/README |
— | — | @@ -0,0 +1,14 @@ |
| 2 | +== About ==
|
| 3 | +
|
| 4 | +Semantic Maps is an extension that adds semantic capabilities to the Maps extension,
|
| 5 | +and therefore provides the ability to add, view and edit coordinate data stored through
|
| 6 | +the Semantic MediaWiki extension, using multiple mapping services. These include Google
|
| 7 | +Maps, Open Layers and Yahoo Maps. Semantic Maps and Maps are based on Semantic Google
|
| 8 | +Maps and Semantic Layers, and are meant to replace these extensions. For this extension
|
| 9 | +to work, you need to have both Semantic MediaWiki and Maps installed.
|
| 10 | +
|
| 11 | +Notes on installing Semantic Maps are found in the file INSTALL.
|
| 12 | +
|
| 13 | +== Contributors ==
|
| 14 | +
|
| 15 | +http://www.mediawiki.org/wiki/Extension:Semantic_Maps#Contributing_to_the_project
|