Index: trunk/extensions/SemanticMaps/includes/queryprinters/SM_QueryHandler.php |
— | — | @@ -12,6 +12,10 @@ |
13 | 13 | */ |
14 | 14 | class SMQueryHandler { |
15 | 15 | |
| 16 | + const LINK_NONE = 0; |
| 17 | + const LINK_RELATIVE = 1; |
| 18 | + const LINK_ABSOLUTE = 2; |
| 19 | + |
16 | 20 | protected $queryResult; |
17 | 21 | protected $outputmode; |
18 | 22 | |
— | — | @@ -20,8 +24,11 @@ |
21 | 25 | // TODO: add system to properly handle query parameters |
22 | 26 | public $template = false; |
23 | 27 | public $icon = ''; |
24 | | - public $makeLinks = false; |
25 | 28 | |
| 29 | + public $titleLink = self::LINK_ABSOLUTE; |
| 30 | + public $propNameLink = self::LINK_NONE; |
| 31 | + public $propValueLink = self::LINK_NONE; |
| 32 | + |
26 | 33 | /** |
27 | 34 | * Constructor. |
28 | 35 | * |
— | — | @@ -71,6 +78,8 @@ |
72 | 79 | * Returns the locations found in the provided result row. |
73 | 80 | * |
74 | 81 | * TODO: split up this method if possible |
| 82 | + * TODO: fix template handling |
| 83 | + * TODO: clean up link type handling |
75 | 84 | * |
76 | 85 | * @since 0.7.3 |
77 | 86 | * |
— | — | @@ -86,7 +95,6 @@ |
87 | 96 | $skin = $wgUser->getSkin(); |
88 | 97 | |
89 | 98 | $title = ''; |
90 | | - $titleForTemplate = ''; |
91 | 99 | $text = ''; |
92 | 100 | $lat = ''; |
93 | 101 | $lon = ''; |
— | — | @@ -101,23 +109,28 @@ |
102 | 110 | // Loop throught all the parts of the field value. |
103 | 111 | while ( ( /* SMWDataValue */ $object = $resultArray->getNextObject() ) !== false ) { |
104 | 112 | if ( $object->getTypeID() == '_wpg' && $i == 0 ) { |
105 | | - $title = $object->getLongText( $this->outputmode, $this->makeLinks ? $skin : NULL ); |
106 | | - $titleForTemplate = $object->getLongText( $this->outputmode, NULL ); |
| 113 | + if ( $this->titleLink == self::LINK_ABSOLUTE ) { |
| 114 | + $title = Html::element( 'a', array( 'href' => $object->getTitle()->getFullUrl() ) ); |
| 115 | + } |
| 116 | + else { |
| 117 | + $title = $object->getLongText( $this->outputmode, $this->titleLink == self::LINK_RELATIVE ? $skin : NULL ); |
| 118 | + } |
107 | 119 | } |
108 | 120 | |
109 | 121 | if ( $object->getTypeID() != '_geo' && $i != 0 ) { |
110 | | - if ( $this->template ) { |
| 122 | + /* |
| 123 | + if ( $this->template ) { |
111 | 124 | if ( $object instanceof SMWWikiPageValue ) { |
112 | 125 | $label[] = $object->getTitle()->getPrefixedText(); |
113 | 126 | } else { |
114 | 127 | $label[] = $object->getLongText( $this->outputmode, $this->makeLinks ? $skin : NULL ); |
115 | 128 | } |
116 | 129 | } |
117 | | - else { |
118 | | - $propertyName = $printRequest->getHTMLText( $this->makeLinks ? $skin : NULL ); |
| 130 | + else { */ |
| 131 | + $propertyName = $printRequest->getHTMLText( $this->propNameLink == self::LINK_RELATIVE ? $skin : NULL ); |
119 | 132 | if ( $propertyName != '' ) $propertyName .= ': '; |
120 | | - $text .= $propertyName . $object->getLongText( $this->outputmode, $this->makeLinks ? $skin : NULL ) . '<br />'; |
121 | | - } |
| 133 | + $text .= $propertyName . $object->getLongText( $this->outputmode, $this->propValueLink == self::LINK_RELATIVE ? $skin : NULL ) . '<br />'; |
| 134 | + //} |
122 | 135 | } |
123 | 136 | |
124 | 137 | if ( $printRequest->getMode() == SMWPrintRequest::PRINT_PROP && $printRequest->getTypeID() == '_geo' ) { |
— | — | @@ -126,10 +139,12 @@ |
127 | 140 | } |
128 | 141 | } |
129 | 142 | |
| 143 | + /* |
130 | 144 | if ( $this->template ) { |
131 | 145 | // New parser object to render the templates with. |
132 | 146 | $parser = new Parser(); |
133 | 147 | } |
| 148 | + */ |
134 | 149 | |
135 | 150 | foreach ( $coords as $coord ) { |
136 | 151 | if ( count( $coord ) >= 2 ) { |
— | — | @@ -142,7 +157,7 @@ |
143 | 158 | |
144 | 159 | if ( $lat != '' && $lon != '' ) { |
145 | 160 | $icon = $this->getLocationIcon( $row ); |
146 | | - |
| 161 | + /* |
147 | 162 | if ( $this->template ) { |
148 | 163 | $segments = array_merge( |
149 | 164 | array( $this->template, 'title=' . $titleForTemplate, 'latitude=' . $lat, 'longitude=' . $lon ), |
— | — | @@ -151,6 +166,7 @@ |
152 | 167 | |
153 | 168 | $text = $parser->parse( '{{' . implode( '|', $segments ) . '}}', $wgTitle, new ParserOptions() )->getText(); |
154 | 169 | } |
| 170 | + */ |
155 | 171 | |
156 | 172 | $location = new MapsLocation(); |
157 | 173 | |
— | — | @@ -171,6 +187,13 @@ |
172 | 188 | } |
173 | 189 | |
174 | 190 | /** |
| 191 | + * Get |
| 192 | + */ |
| 193 | + protected function getDataValueLink() { |
| 194 | + |
| 195 | + } |
| 196 | + |
| 197 | + /** |
175 | 198 | * Get the icon for a row. |
176 | 199 | * |
177 | 200 | * @since 0.7.3 |
Index: trunk/extensions/SemanticMaps/SemanticMaps.php |
— | — | @@ -38,7 +38,7 @@ |
39 | 39 | |
40 | 40 | // Only initialize the extension when all dependencies are present. |
41 | 41 | if ( defined( 'Maps_VERSION' ) && defined( 'SMW_VERSION' ) ) { |
42 | | - define( 'SM_VERSION', '0.7.3 a2' ); |
| 42 | + define( 'SM_VERSION', '0.7.3 a3' ); |
43 | 43 | |
44 | 44 | $useExtensionPath = version_compare( $wgVersion, '1.16', '>=' ) && isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath; |
45 | 45 | $smgScriptPath = ( $useExtensionPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions' ) . '/SemanticMaps'; |