http://www.mediawiki.org/wiki/Special:Code/MediaWiki/65328
Revision: 65328
Author: jeroendedauw
Date: 2010-04-20 15:27:37 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Changes for 0.6 - fixed compatibility issue with SMW 1.5.1.
Note: this version is unstable and will not work properly with the latest Maps
version.
Modified Paths:
--------------
trunk/extensions/SemanticMaps/FormInputs/SM_FormInput.php
trunk/extensions/SemanticMaps/FormInputs/SM_FormInputs.php
trunk/extensions/SemanticMaps/GeoCoords/SM_GeoCoordsValue.php
trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php
trunk/extensions/SemanticMaps/QueryPrinters/SM_QueryPrinters.php
trunk/extensions/SemanticMaps/SemanticMaps.php
Modified: trunk/extensions/SemanticMaps/FormInputs/SM_FormInput.php
===================================================================
--- trunk/extensions/SemanticMaps/FormInputs/SM_FormInput.php 2010-04-20
15:10:46 UTC (rev 65327)
+++ trunk/extensions/SemanticMaps/FormInputs/SM_FormInput.php 2010-04-20
15:27:37 UTC (rev 65328)
@@ -52,34 +52,32 @@
$this->setMapSettings();
- $this->featureParameters = SMFormInputs::$parameters;
+ parent::setMapProperties( $field_args, __CLASS__ );
$this->doMapServiceLoad();
$this->manageGeocoding();
- if ( parent::manageMapProperties( $field_args, __CLASS__ ) ) {
- $this->setCoordinates();
- $this->setCentre();
- $this->setZoom();
-
- // Create html element names.
- $this->setMapName();
- $this->mapName .= '_' . $sfgTabIndex;
- $this->geocodeFieldName = $this->elementNamePrefix .
'_geocode_' . $this->elementNr . '_' . $sfgTabIndex;
- $this->coordsFieldName = $this->elementNamePrefix .
'_coords_' . $this->elementNr . '_' . $sfgTabIndex;
- $this->infoFieldName = $this->elementNamePrefix .
'_info_' . $this->elementNr . '_' . $sfgTabIndex;
-
- // Create the non specific form HTML.
- $this->output .= "
- <input id='" . $this->coordsFieldName . "'
name='$input_name' type='text' value='$this->startingCoords' size='40'
tabindex='$sfgTabIndex'>
- <span id='" . $this->infoFieldName . "'
class='error_message'></span>";
-
- if ( $this->enableGeocoding )
$this->addGeocodingField();
-
- $this->addSpecificMapHTML( $wgParser );
- }
+ $this->setCoordinates();
+ $this->setCentre();
+ $this->setZoom();
+ // Create html element names.
+ $this->setMapName();
+ $this->mapName .= '_' . $sfgTabIndex;
+ $this->geocodeFieldName = $this->elementNamePrefix .
'_geocode_' . $this->elementNr . '_' . $sfgTabIndex;
+ $this->coordsFieldName = $this->elementNamePrefix . '_coords_'
. $this->elementNr . '_' . $sfgTabIndex;
+ $this->infoFieldName = $this->elementNamePrefix . '_info_' .
$this->elementNr . '_' . $sfgTabIndex;
+
+ // Create the non specific form HTML.
+ $this->output .= "
+ <input id='" . $this->coordsFieldName . "' name='$input_name'
type='text' value='$this->startingCoords' size='40' tabindex='$sfgTabIndex'>
+ <span id='" . $this->infoFieldName . "'
class='error_message'></span>";
+
+ if ( $this->enableGeocoding ) $this->addGeocodingField();
+
+ $this->addSpecificMapHTML( $wgParser );
+
return array( $this->output . $this->errorList, '' );
}
Modified: trunk/extensions/SemanticMaps/FormInputs/SM_FormInputs.php
===================================================================
--- trunk/extensions/SemanticMaps/FormInputs/SM_FormInputs.php 2010-04-20
15:10:46 UTC (rev 65327)
+++ trunk/extensions/SemanticMaps/FormInputs/SM_FormInputs.php 2010-04-20
15:27:37 UTC (rev 65328)
@@ -57,35 +57,33 @@
}
private static function initializeParams() {
- global $egMapsAvailableServices, $egMapsDefaultServices,
$egMapsDefaultCentre, $egMapsAvailableGeoServices, $egMapsDefaultGeoService;
+ global $egMapsAvailableServices, $egMapsDefaultServices,
$egMapsAvailableGeoServices, $egMapsDefaultGeoService;
self::$parameters = array(
'centre' => array(
'aliases' => array( 'center' ),
- 'default' => $egMapsDefaultCentre
- ),
+ ),
'geoservice' => array(
'criteria' => array(
'in_array' => array_keys(
$egMapsAvailableGeoServices )
- ),
- 'default' => $egMapsDefaultGeoService
),
+ 'default' => $egMapsDefaultGeoService
+ ),
'service_name' => array(),
'part_of_multiple' => array(),
'possible_values' => array(
'type' => array( 'string', 'array' ),
- ),
+ ),
'is_list' => array(),
'semantic_property' => array(),
'value_labels' => array(),
- );
+ );
}
/**
* Adds a mapping service's form hook.
*
* @param string $inputName The name of the form input.
- * @param array $fi
* @param strig $mainName
*/
private static function initFormHook( $inputName, $mainName = '' ) {
@@ -102,10 +100,10 @@
/**
* Calls the relevant form input class depending on the provided service.
*
- * @param unknown_type $coordinates
- * @param unknown_type $input_name
- * @param unknown_type $is_mandatory
- * @param unknown_type $is_disabled
+ * @param string $coordinates
+ * @param string $input_name
+ * @param boolean $is_mandatory
+ * @param boolean $is_disabled
* @param array $field_args
*
* @return array
Modified: trunk/extensions/SemanticMaps/GeoCoords/SM_GeoCoordsValue.php
===================================================================
--- trunk/extensions/SemanticMaps/GeoCoords/SM_GeoCoordsValue.php
2010-04-20 15:10:46 UTC (rev 65327)
+++ trunk/extensions/SemanticMaps/GeoCoords/SM_GeoCoordsValue.php
2010-04-20 15:27:37 UTC (rev 65328)
@@ -85,10 +85,10 @@
* @see SMWDataValue::parseDBkeys
*/
protected function parseDBkeys( $args ) {
- list( $this->mCoordinateSet['lat'],
$this->mCoordinateSet['lon'] ) = explode( ',', $args[0] );
+ $this->mCoordinateSet['lat'] = $args[0];
+ $this->mCoordinateSet['lon'] = $args[1];
- // TODO: parse coodinates to some notation, depending on a new
setting
- $this->m_caption = $this->mCoordinateSet['lat'] . ', ' .
$this->mCoordinateSet['lon'];
+ $this->m_caption = MapsCoordinateParser::formatCoordinates(
$this->mCoordinateSet );
$this->mWikivalue = $this->m_caption;
}
@@ -97,21 +97,21 @@
*/
public function getDBkeys() {
$this->unstub();
- return array( $this->mCoordinateSet['lat'] . ',' .
$this->mCoordinateSet['lon'] );
+ return array( $this->mCoordinateSet['lat'],
$this->mCoordinateSet['lon'] );
}
/**
* @see SMWDataValue::getShortWikiText
*
- * TODO: make the output here more readible (and iff possible
informative)
+ * TODO: make the output here more readible (and if possible
informative)
*/
public function getShortWikiText( $linked = null ) {
if ( $this->isValid() && ( $linked !== null ) && ( $linked !==
false ) ) {
SMWOutputs::requireHeadItem( SMW_HEADER_TOOLTIP );
return '<span class="smwttinline">' . $this->m_caption
. '<span class="smwttcontent">' .
- wfMsgForContent( 'maps-latitude' ) . ' ' .
$this->mCoordinateSet['lat'] . '<br />' .
- wfMsgForContent( 'maps-longitude' ) . ' ' .
$this->mCoordinateSet['lon'] .
- '</span></span>';
+ wfMsgForContent( 'maps-latitude' ) . ' ' .
$this->mCoordinateSet['lat'] . '<br />' .
+ wfMsgForContent( 'maps-longitude' ) . ' ' .
$this->mCoordinateSet['lon'] .
+ '</span></span>';
} else {
return $this->m_caption;
}
@@ -132,8 +132,7 @@
if ( !$this->isValid() ) {
return $this->getErrorText();
} else {
- // TODO: parse coodinates to some notation, depending
on a new setting
- return $this->mCoordinateSet['lat'] . ', ' .
$this->mCoordinateSet['lon'];
+ return MapsCoordinateParser::formatCoordinates(
$this->mCoordinateSet );
}
}
@@ -158,8 +157,11 @@
*/
public function getExportData() {
if ( $this->isValid() ) {
- // TODO: parse coodinates to some notation, depending
on a new setting
- $lit = new SMWExpLiteral( $this->mCoordinateSet['lat']
. ', ' . $this->mCoordinateSet['lon'], $this,
'http://www.w3.org/2001/XMLSchema#string' );
+ $lit = new SMWExpLiteral(
+ MapsCoordinateParser::formatCoordinates(
$this->mCoordinateSet ),
+ $this,
+ 'http://www.w3.org/2001/XMLSchema#string'
+ );
return new SMWExpData( $lit );
} else {
return null;
@@ -170,7 +172,7 @@
* Create links to mapping services based on a wiki-editable message.
The parameters
* available to the message are:
*
- *
+ * @return array
*/
protected function getServiceLinkParams() {
return array( ); // TODO
Modified: trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php
===================================================================
--- trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php
2010-04-20 15:10:46 UTC (rev 65327)
+++ trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php
2010-04-20 15:27:37 UTC (rev 65328)
@@ -125,7 +125,7 @@
* again overidden by the service parameters (the ones spesific
to the service),
* and finally by the spesific parameters (the ones spesific to
a service-feature combination).
*/
- $parameterInfo = array_merge( MapsMapper::getMainParams(),
$this->featureParameters );
+ $parameterInfo = /* array_merge( MapsMapper::getMainParams(),
*/ $this->featureParameters /*)*/;
$parameterInfo = array_merge( $parameterInfo,
$egMapsServices[$this->serviceName]['parameters'] );
$parameterInfo = array_merge( $parameterInfo,
$this->spesificParameters );
@@ -217,16 +217,17 @@
}
if ( $pr->getMode() ==
SMWPrintRequest::PRINT_PROP && $pr->getTypeID() == '_geo' ) {
- $coords[] = explode( ',',
$object->getXSDValue() );
+ $coords[] = $object->getDBkeys();
}
}
}
foreach ( $coords as $coord ) {
- if ( count( $coord ) == 2 ) {
- list( $lat, $lon ) = $coord;
-
- if ( strlen( $lat ) > 0 && strlen( $lon ) > 0 )
{
+ if ( count( $coord ) >= 2 ) {
+ $lat = $coord[0];
+ $lon = $coord[1];
+
+ if ( $lat != '' && $lon != '' ) {
$icon = $this->getLocationIcon( $row );
if ( $this->template ) {
@@ -239,7 +240,6 @@
}
$this->m_locations[] = array(
- // TODO: add escaping to title
and label (they are getting escaped now on some place where they shouldn't)
Xml::escapeJsString( $lat ),
Xml::escapeJsString( $lon ),
Xml::escapeJsString( $title ),
Modified: trunk/extensions/SemanticMaps/QueryPrinters/SM_QueryPrinters.php
===================================================================
--- trunk/extensions/SemanticMaps/QueryPrinters/SM_QueryPrinters.php
2010-04-20 15:10:46 UTC (rev 65327)
+++ trunk/extensions/SemanticMaps/QueryPrinters/SM_QueryPrinters.php
2010-04-20 15:27:37 UTC (rev 65328)
@@ -55,7 +55,7 @@
}
private static function initializeParams() {
- global $egMapsDefaultServices, $egMapsDefaultCentre,
$egMapsAvailableGeoServices, $egMapsDefaultGeoService;
+ global $egMapsDefaultServices, $egMapsAvailableGeoServices,
$egMapsDefaultGeoService;
global $smgQPForceShow, $smgQPShowTitle, $smgQPTemplate;
self::$parameters = array(
@@ -71,7 +71,6 @@
),
'centre' => array(
'aliases' => array( 'center' ),
- 'default' => $egMapsDefaultCentre
),
'forceshow' => array(
'type' => 'boolean',
Modified: trunk/extensions/SemanticMaps/SemanticMaps.php
===================================================================
--- trunk/extensions/SemanticMaps/SemanticMaps.php 2010-04-20 15:10:46 UTC
(rev 65327)
+++ trunk/extensions/SemanticMaps/SemanticMaps.php 2010-04-20 15:27:37 UTC
(rev 65328)
@@ -35,7 +35,7 @@
// Only initialize the extension when all dependencies are present.
if ( defined( 'Maps_VERSION' ) && defined( 'SMW_VERSION' ) ) {
- define( 'SM_VERSION', '0.6 a13' );
+ define( 'SM_VERSION', '0.6 a15' );
$smgScriptPath = ( isset( $wgExtensionAssetsPath ) &&
$wgExtensionAssetsPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions'
) . '/SemanticMaps';
$smgDir = dirname( __FILE__ ) . '/';
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs