Index: trunk/extensions/SemanticMaps/RELEASE-NOTES |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | === Semantic Maps 1.0.1 === |
12 | 12 | (2011-xx-xx) |
13 | 13 | |
14 | | -* |
| 14 | +* Fixed handling of the semantic link caption in the geographical coordinate datavalue class. |
15 | 15 | |
16 | 16 | === Semantic Maps 1.0 === |
17 | 17 | (2011-07-19) |
Index: trunk/extensions/SemanticMaps/includes/SM_GeoCoordsValue.php |
— | — | @@ -31,13 +31,11 @@ |
32 | 32 | $this->m_dataitem = $dataItem; |
33 | 33 | |
34 | 34 | global $smgQPCoodFormat, $smgQPCoodDirectional; |
35 | | - $this->m_caption = MapsCoordinateParser::formatCoordinates( |
| 35 | + $this->wikiValue = MapsCoordinateParser::formatCoordinates( |
36 | 36 | $dataItem->getCoordinateSet(), |
37 | 37 | $smgQPCoodFormat, |
38 | 38 | $smgQPCoodDirectional |
39 | 39 | ); |
40 | | - |
41 | | - $this->wikiValue = $this->m_caption; |
42 | 40 | return true; |
43 | 41 | } else { |
44 | 42 | return false; |
— | — | @@ -102,11 +100,6 @@ |
103 | 101 | $parsedCoords = MapsCoordinateParser::parseCoordinates( $coordinates ); |
104 | 102 | if ( $parsedCoords ) { |
105 | 103 | $this->m_dataitem = new SMWDIGeoCoord( $parsedCoords ); |
106 | | - |
107 | | - if ( $this->m_caption === false && !$asQuery ) { |
108 | | - global $smgQPCoodFormat, $smgQPCoodDirectional; |
109 | | - $this->m_caption = MapsCoordinateParser::formatCoordinates( $parsedCoords, $smgQPCoodFormat, $smgQPCoodDirectional ); |
110 | | - } |
111 | 104 | } else { |
112 | 105 | $this->addError( wfMsgExt( 'maps_unrecognized_coords', array( 'parsemag' ), $coordinates, 1 ) ); |
113 | 106 | $this->m_dataitem = new SMWDIGeoCoord( array(0, 0) ); // make sure this is always set |
— | — | @@ -133,12 +126,18 @@ |
134 | 127 | * @since 0.6 |
135 | 128 | */ |
136 | 129 | public function getShortWikiText( $linked = null ) { |
137 | | - if ( !$this->isValid() ) { |
| 130 | + if ( $this->isValid() ) { |
| 131 | + if ( $this->m_caption === false ) { |
| 132 | + global $smgQPCoodFormat, $smgQPCoodDirectional; |
| 133 | + return MapsCoordinateParser::formatCoordinates( $this->m_dataitem->getCoordinateSet(), $smgQPCoodFormat, $smgQPCoodDirectional ); |
| 134 | + } |
| 135 | + else { |
| 136 | + return $this->m_caption; |
| 137 | + } |
| 138 | + } |
| 139 | + else { |
138 | 140 | return $this->getErrorText(); |
139 | | - } else { |
140 | | - global $smgQPCoodFormat, $smgQPCoodDirectional; |
141 | | - return MapsCoordinateParser::formatCoordinates( $this->m_dataitem->getCoordinateSet(), $smgQPCoodFormat, $smgQPCoodDirectional ); |
142 | | - } |
| 141 | + } |
143 | 142 | } |
144 | 143 | |
145 | 144 | /** |
— | — | @@ -161,13 +160,16 @@ |
162 | 161 | |
163 | 162 | // TODO: fix lang keys so they include the space and coordinates. |
164 | 163 | $coordinateSet = $this->m_dataitem->getCoordinateSet(); |
| 164 | + |
| 165 | + global $smgQPCoodFormat, $smgQPCoodDirectional; |
| 166 | + $text = MapsCoordinateParser::formatCoordinates( $coordinateSet, $smgQPCoodFormat, $smgQPCoodDirectional ); |
165 | 167 | |
166 | | - return '<span class="smwttinline">' . htmlspecialchars( $this->m_caption ) . '<span class="smwttcontent">' . |
| 168 | + return '<span class="smwttinline">' . htmlspecialchars( $text ) . '<span class="smwttcontent">' . |
167 | 169 | htmlspecialchars ( wfMsgForContent( 'maps-latitude' ) . ' ' . $coordinateSet['lat'] ) . '<br />' . |
168 | 170 | htmlspecialchars ( wfMsgForContent( 'maps-longitude' ) . ' ' . $coordinateSet['lon'] ) . |
169 | 171 | '</span></span>'; |
170 | 172 | } else { |
171 | | - return htmlspecialchars( $this->m_caption ); |
| 173 | + return $this->getErrorText(); |
172 | 174 | } |
173 | 175 | } |
174 | 176 | |