r7165 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r7164‎ | r7165 | r7166 >
Date:14:59, 18 January 2005
Author:magnus_manske
Status:old
Tags:
Comment:
clickable labels - cool
Modified paths:
  • /trunk/extensions/geo/geo.php (modified) (history)

Diff [purge]

Index: trunk/extensions/geo/geo.php
@@ -51,20 +51,8 @@
5252 else $vb = trim ( strtolower ( $e[1] ) ) ;# /*$this->styles*/$kv[$c][$e[0]] = trim ( strtolower ( $e[1] ) ) ;
5353 if ( $key == "style" ) $this->styles[$c][$va] = $vb ;
5454 else $this->label_styles[$c][$va] = $vb ;
55 -# print "{$va} : " .$vb. "\n" ;
5655 }
5756 }
58 -# $this->styles[$c][] = $a[1] ;
59 -/* else if ( $key == "label" )
60 - {
61 - $d = explode ( ";" , str_replace ( "," , ";" , $a[1] ) ) ;
62 - foreach ( $d AS $e )
63 - {
64 - $e = explode ( ":" , $e ) ;
65 - if ( count ( $e ) < 2 ) $this->label_styles[$c][$e[0]] = "" ;
66 - else $this->label_styles[$c][$e[0]] = $e[1] ;
67 - }
68 - }*/
6957 }
7058 }
7159 }
@@ -101,7 +89,7 @@
10290 # Finalizing
10391 $viewBox = $this->get_view_box () ;
10492 $svg =
105 - '<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
 93+ '<?xml version="1.0" encoding="utf-8" standalone="no"?>
10694 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/SVG/DTD/svg10.dtd">
10795 <svg viewBox="' . $viewBox .
10896 '" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
@@ -163,29 +151,6 @@
164152 return implode ( "; " , $ret ) ;
165153 }
166154
167 -/*
168 - function get_styles ( $id , $type )
169 - {
170 - # Universal constants; rivers are blue!
171 - if ( $type == "river" )
172 - return "fill:none; stroke:blue; stroke-width:2" ;
173 -
174 - if ( isset ( $this->styles[$id] ) )
175 - return $this->styles[$id] ;
176 -
177 - $ret = $this->styles["default"] ; # Default, if not overwritten by anything more specific
178 - foreach ( $this->object_tree AS $object )
179 - {
180 - $o = explode ( ";" , $object ) ;
181 - $s = $this->match_object_style ( $o[0] , $o[1] ) ;
182 - if ( $s != "" ) $ret .= "; " . $s ;
183 - $s = $this->match_object_style ( $o[0] , $type ) ;
184 - if ( $s != "" ) $ret .= "; " . $s ;
185 - }
186 -
187 - return $ret ;
188 - }
189 -*/
190155 function data_to_real ( &$x , &$y )
191156 {
192157 $x = coordinate_to_number ( coordinate_take_apart ( $x ) ) ;
@@ -255,11 +220,10 @@
256221 $s .= "{$pk}: {$pv}; " ;
257222
258223 $s .= "' x='{$x}' y='{$y}'>{$text}</text>" ;
259 - if ( isset ( $l['href'] ) )
 224+ if ( isset ( $l['style']['href'] ) )
260225 {
261 - print $l['href'] . "\n" ;
262 - $href = $l['href'] ;
263 - $s = "<a xlink:href={$href}>{$s}</a>" ;
 226+ $href = $l['style']['href'] ;
 227+ $s = "<a xlink:href=\"{$href}\">{$s}</a>" ;
264228 }
265229 $ret .= $s."\n" ;
266230 }
@@ -473,7 +437,7 @@
474438 if ( !$this->label_this ( $params ) ) return ;
475439 $text = $this->get_specs ( "name" , $params->languages ) ;
476440 if ( $text == "" ) return "" ; # No label found
477 - $text = utf8_decode ( $this->data[$text][0] ) ;
 441+ $text = $this->data[$text][0] ;
478442 if ( $text == "" ) return "" ; # No point in showing an empty label
479443 $x = floor ( $x ) ;
480444 $y = floor ( $y ) ;
@@ -482,8 +446,9 @@
483447 $a['style'] = $this->get_label_style ( &$params ) ;
484448 if ( isset ( $a['style']['clickable'] ) )
485449 {
 450+ $href = "http://" . $params->languages[0] . ".wikipedia.org/wiki/" . str_replace ( " " , "_" , $text ) ;
486451 unset ( $a['style']['clickable'] ) ; # Shouldn't show up in style list
487 - $a['style']['href'] = "http://www.google.de" ;
 452+ $a['style']['href'] = $href ;
488453 }
489454 $params->add_label ( $a ) ;
490455 }
@@ -588,9 +553,6 @@
589554 $s .= "{$k}:{$v}; " ;
590555 $ret = "style=\"{$s}\"" ;
591556 return $ret ;
592 -# $t = trim ( strtolower ( $this->get_current_type ( $params ) ) ) ;
593 -# $s = $params->get_styles ( $this->id , $t ) ;
594 -# return "style=\"{$s}\"" ;
595557 }
596558 }
597559

Status & tagging log