Index: trunk/extensions/SemanticMaps/GeoCoords/SM_GeoCoordsValue.php |
— | — | @@ -85,10 +85,10 @@ |
86 | 86 | * @see SMWDataValue::parseDBkeys |
87 | 87 | */ |
88 | 88 | protected function parseDBkeys( $args ) { |
89 | | - list( $this->mCoordinateSet['lat'], $this->mCoordinateSet['lon'] ) = explode( ',', $args[0] ); |
| 89 | + $this->mCoordinateSet['lat'] = $args[0]; |
| 90 | + $this->mCoordinateSet['lon'] = $args[1]; |
90 | 91 | |
91 | | - // TODO: parse coodinates to some notation, depending on a new setting |
92 | | - $this->m_caption = $this->mCoordinateSet['lat'] . ', ' . $this->mCoordinateSet['lon']; |
| 92 | + $this->m_caption = MapsCoordinateParser::formatCoordinates( $this->mCoordinateSet ); |
93 | 93 | $this->mWikivalue = $this->m_caption; |
94 | 94 | } |
95 | 95 | |
— | — | @@ -97,21 +97,21 @@ |
98 | 98 | */ |
99 | 99 | public function getDBkeys() { |
100 | 100 | $this->unstub(); |
101 | | - return array( $this->mCoordinateSet['lat'] . ',' . $this->mCoordinateSet['lon'] ); |
| 101 | + return array( $this->mCoordinateSet['lat'], $this->mCoordinateSet['lon'] ); |
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | 105 | * @see SMWDataValue::getShortWikiText |
106 | 106 | * |
107 | | - * TODO: make the output here more readible (and iff possible informative) |
| 107 | + * TODO: make the output here more readible (and if possible informative) |
108 | 108 | */ |
109 | 109 | public function getShortWikiText( $linked = null ) { |
110 | 110 | if ( $this->isValid() && ( $linked !== null ) && ( $linked !== false ) ) { |
111 | 111 | SMWOutputs::requireHeadItem( SMW_HEADER_TOOLTIP ); |
112 | 112 | return '<span class="smwttinline">' . $this->m_caption . '<span class="smwttcontent">' . |
113 | | - wfMsgForContent( 'maps-latitude' ) . ' ' . $this->mCoordinateSet['lat'] . '<br />' . |
114 | | - wfMsgForContent( 'maps-longitude' ) . ' ' . $this->mCoordinateSet['lon'] . |
115 | | - '</span></span>'; |
| 113 | + wfMsgForContent( 'maps-latitude' ) . ' ' . $this->mCoordinateSet['lat'] . '<br />' . |
| 114 | + wfMsgForContent( 'maps-longitude' ) . ' ' . $this->mCoordinateSet['lon'] . |
| 115 | + '</span></span>'; |
116 | 116 | } else { |
117 | 117 | return $this->m_caption; |
118 | 118 | } |
— | — | @@ -132,8 +132,7 @@ |
133 | 133 | if ( !$this->isValid() ) { |
134 | 134 | return $this->getErrorText(); |
135 | 135 | } else { |
136 | | - // TODO: parse coodinates to some notation, depending on a new setting |
137 | | - return $this->mCoordinateSet['lat'] . ', ' . $this->mCoordinateSet['lon']; |
| 136 | + return MapsCoordinateParser::formatCoordinates( $this->mCoordinateSet ); |
138 | 137 | } |
139 | 138 | } |
140 | 139 | |
— | — | @@ -158,8 +157,11 @@ |
159 | 158 | */ |
160 | 159 | public function getExportData() { |
161 | 160 | if ( $this->isValid() ) { |
162 | | - // TODO: parse coodinates to some notation, depending on a new setting |
163 | | - $lit = new SMWExpLiteral( $this->mCoordinateSet['lat'] . ', ' . $this->mCoordinateSet['lon'], $this, 'http://www.w3.org/2001/XMLSchema#string' ); |
| 161 | + $lit = new SMWExpLiteral( |
| 162 | + MapsCoordinateParser::formatCoordinates( $this->mCoordinateSet ), |
| 163 | + $this, |
| 164 | + 'http://www.w3.org/2001/XMLSchema#string' |
| 165 | + ); |
164 | 166 | return new SMWExpData( $lit ); |
165 | 167 | } else { |
166 | 168 | return null; |
— | — | @@ -170,7 +172,7 @@ |
171 | 173 | * Create links to mapping services based on a wiki-editable message. The parameters |
172 | 174 | * available to the message are: |
173 | 175 | * |
174 | | - * |
| 176 | + * @return array |
175 | 177 | */ |
176 | 178 | protected function getServiceLinkParams() { |
177 | 179 | return array( ); // TODO |
Index: trunk/extensions/SemanticMaps/FormInputs/SM_FormInput.php |
— | — | @@ -52,34 +52,32 @@ |
53 | 53 | |
54 | 54 | $this->setMapSettings(); |
55 | 55 | |
56 | | - $this->featureParameters = SMFormInputs::$parameters; |
| 56 | + parent::setMapProperties( $field_args, __CLASS__ ); |
57 | 57 | |
58 | 58 | $this->doMapServiceLoad(); |
59 | 59 | |
60 | 60 | $this->manageGeocoding(); |
61 | 61 | |
62 | | - if ( parent::manageMapProperties( $field_args, __CLASS__ ) ) { |
63 | | - $this->setCoordinates(); |
64 | | - $this->setCentre(); |
65 | | - $this->setZoom(); |
66 | | - |
67 | | - // Create html element names. |
68 | | - $this->setMapName(); |
69 | | - $this->mapName .= '_' . $sfgTabIndex; |
70 | | - $this->geocodeFieldName = $this->elementNamePrefix . '_geocode_' . $this->elementNr . '_' . $sfgTabIndex; |
71 | | - $this->coordsFieldName = $this->elementNamePrefix . '_coords_' . $this->elementNr . '_' . $sfgTabIndex; |
72 | | - $this->infoFieldName = $this->elementNamePrefix . '_info_' . $this->elementNr . '_' . $sfgTabIndex; |
73 | | - |
74 | | - // Create the non specific form HTML. |
75 | | - $this->output .= " |
76 | | - <input id='" . $this->coordsFieldName . "' name='$input_name' type='text' value='$this->startingCoords' size='40' tabindex='$sfgTabIndex'> |
77 | | - <span id='" . $this->infoFieldName . "' class='error_message'></span>"; |
78 | | - |
79 | | - if ( $this->enableGeocoding ) $this->addGeocodingField(); |
80 | | - |
81 | | - $this->addSpecificMapHTML( $wgParser ); |
82 | | - } |
| 62 | + $this->setCoordinates(); |
| 63 | + $this->setCentre(); |
| 64 | + $this->setZoom(); |
83 | 65 | |
| 66 | + // Create html element names. |
| 67 | + $this->setMapName(); |
| 68 | + $this->mapName .= '_' . $sfgTabIndex; |
| 69 | + $this->geocodeFieldName = $this->elementNamePrefix . '_geocode_' . $this->elementNr . '_' . $sfgTabIndex; |
| 70 | + $this->coordsFieldName = $this->elementNamePrefix . '_coords_' . $this->elementNr . '_' . $sfgTabIndex; |
| 71 | + $this->infoFieldName = $this->elementNamePrefix . '_info_' . $this->elementNr . '_' . $sfgTabIndex; |
| 72 | + |
| 73 | + // Create the non specific form HTML. |
| 74 | + $this->output .= " |
| 75 | + <input id='" . $this->coordsFieldName . "' name='$input_name' type='text' value='$this->startingCoords' size='40' tabindex='$sfgTabIndex'> |
| 76 | + <span id='" . $this->infoFieldName . "' class='error_message'></span>"; |
| 77 | + |
| 78 | + if ( $this->enableGeocoding ) $this->addGeocodingField(); |
| 79 | + |
| 80 | + $this->addSpecificMapHTML( $wgParser ); |
| 81 | + |
84 | 82 | return array( $this->output . $this->errorList, '' ); |
85 | 83 | } |
86 | 84 | |
Index: trunk/extensions/SemanticMaps/FormInputs/SM_FormInputs.php |
— | — | @@ -57,35 +57,33 @@ |
58 | 58 | } |
59 | 59 | |
60 | 60 | private static function initializeParams() { |
61 | | - global $egMapsAvailableServices, $egMapsDefaultServices, $egMapsDefaultCentre, $egMapsAvailableGeoServices, $egMapsDefaultGeoService; |
| 61 | + global $egMapsAvailableServices, $egMapsDefaultServices, $egMapsAvailableGeoServices, $egMapsDefaultGeoService; |
62 | 62 | |
63 | 63 | self::$parameters = array( |
64 | 64 | 'centre' => array( |
65 | 65 | 'aliases' => array( 'center' ), |
66 | | - 'default' => $egMapsDefaultCentre |
67 | | - ), |
| 66 | + ), |
68 | 67 | 'geoservice' => array( |
69 | 68 | 'criteria' => array( |
70 | 69 | 'in_array' => array_keys( $egMapsAvailableGeoServices ) |
71 | | - ), |
72 | | - 'default' => $egMapsDefaultGeoService |
73 | 70 | ), |
| 71 | + 'default' => $egMapsDefaultGeoService |
| 72 | + ), |
74 | 73 | 'service_name' => array(), |
75 | 74 | 'part_of_multiple' => array(), |
76 | 75 | 'possible_values' => array( |
77 | 76 | 'type' => array( 'string', 'array' ), |
78 | | - ), |
| 77 | + ), |
79 | 78 | 'is_list' => array(), |
80 | 79 | 'semantic_property' => array(), |
81 | 80 | 'value_labels' => array(), |
82 | | - ); |
| 81 | + ); |
83 | 82 | } |
84 | 83 | |
85 | 84 | /** |
86 | 85 | * Adds a mapping service's form hook. |
87 | 86 | * |
88 | 87 | * @param string $inputName The name of the form input. |
89 | | - * @param array $fi |
90 | 88 | * @param strig $mainName |
91 | 89 | */ |
92 | 90 | private static function initFormHook( $inputName, $mainName = '' ) { |
— | — | @@ -102,10 +100,10 @@ |
103 | 101 | /** |
104 | 102 | * Calls the relevant form input class depending on the provided service. |
105 | 103 | * |
106 | | - * @param unknown_type $coordinates |
107 | | - * @param unknown_type $input_name |
108 | | - * @param unknown_type $is_mandatory |
109 | | - * @param unknown_type $is_disabled |
| 104 | + * @param string $coordinates |
| 105 | + * @param string $input_name |
| 106 | + * @param boolean $is_mandatory |
| 107 | + * @param boolean $is_disabled |
110 | 108 | * @param array $field_args |
111 | 109 | * |
112 | 110 | * @return array |
Index: trunk/extensions/SemanticMaps/SemanticMaps.php |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | |
37 | 37 | // Only initialize the extension when all dependencies are present. |
38 | 38 | if ( defined( 'Maps_VERSION' ) && defined( 'SMW_VERSION' ) ) { |
39 | | - define( 'SM_VERSION', '0.6 a13' ); |
| 39 | + define( 'SM_VERSION', '0.6 a15' ); |
40 | 40 | |
41 | 41 | $smgScriptPath = ( isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions' ) . '/SemanticMaps'; |
42 | 42 | $smgDir = dirname( __FILE__ ) . '/'; |
Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_QueryPrinters.php |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | } |
57 | 57 | |
58 | 58 | private static function initializeParams() { |
59 | | - global $egMapsDefaultServices, $egMapsDefaultCentre, $egMapsAvailableGeoServices, $egMapsDefaultGeoService; |
| 59 | + global $egMapsDefaultServices, $egMapsAvailableGeoServices, $egMapsDefaultGeoService; |
60 | 60 | global $smgQPForceShow, $smgQPShowTitle, $smgQPTemplate; |
61 | 61 | |
62 | 62 | self::$parameters = array( |
— | — | @@ -71,7 +71,6 @@ |
72 | 72 | ), |
73 | 73 | 'centre' => array( |
74 | 74 | 'aliases' => array( 'center' ), |
75 | | - 'default' => $egMapsDefaultCentre |
76 | 75 | ), |
77 | 76 | 'forceshow' => array( |
78 | 77 | 'type' => 'boolean', |
Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php |
— | — | @@ -125,7 +125,7 @@ |
126 | 126 | * again overidden by the service parameters (the ones spesific to the service), |
127 | 127 | * and finally by the spesific parameters (the ones spesific to a service-feature combination). |
128 | 128 | */ |
129 | | - $parameterInfo = array_merge( MapsMapper::getMainParams(), $this->featureParameters ); |
| 129 | + $parameterInfo = /* array_merge( MapsMapper::getMainParams(), */ $this->featureParameters /*)*/; |
130 | 130 | $parameterInfo = array_merge( $parameterInfo, $egMapsServices[$this->serviceName]['parameters'] ); |
131 | 131 | $parameterInfo = array_merge( $parameterInfo, $this->spesificParameters ); |
132 | 132 | |
— | — | @@ -217,16 +217,17 @@ |
218 | 218 | } |
219 | 219 | |
220 | 220 | if ( $pr->getMode() == SMWPrintRequest::PRINT_PROP && $pr->getTypeID() == '_geo' ) { |
221 | | - $coords[] = explode( ',', $object->getXSDValue() ); |
| 221 | + $coords[] = $object->getDBkeys(); |
222 | 222 | } |
223 | 223 | } |
224 | 224 | } |
225 | 225 | |
226 | 226 | foreach ( $coords as $coord ) { |
227 | | - if ( count( $coord ) == 2 ) { |
228 | | - list( $lat, $lon ) = $coord; |
229 | | - |
230 | | - if ( strlen( $lat ) > 0 && strlen( $lon ) > 0 ) { |
| 227 | + if ( count( $coord ) >= 2 ) { |
| 228 | + $lat = $coord[0]; |
| 229 | + $lon = $coord[1]; |
| 230 | + |
| 231 | + if ( $lat != '' && $lon != '' ) { |
231 | 232 | $icon = $this->getLocationIcon( $row ); |
232 | 233 | |
233 | 234 | if ( $this->template ) { |
— | — | @@ -239,7 +240,6 @@ |
240 | 241 | } |
241 | 242 | |
242 | 243 | $this->m_locations[] = array( |
243 | | - // TODO: add escaping to title and label (they are getting escaped now on some place where they shouldn't) |
244 | 244 | Xml::escapeJsString( $lat ), |
245 | 245 | Xml::escapeJsString( $lon ), |
246 | 246 | Xml::escapeJsString( $title ), |