Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialProperties.php |
— | — | @@ -52,6 +52,8 @@ |
53 | 53 | } |
54 | 54 | |
55 | 55 | function formatResult( $skin, $result ) { |
| 56 | + $linker = smwfGetLinker(); |
| 57 | + |
56 | 58 | $typestring = ''; |
57 | 59 | $errors = array(); |
58 | 60 | |
— | — | @@ -67,25 +69,25 @@ |
68 | 70 | $types = smwfGetStore()->getPropertyValues( $diWikiPage, $typeProperty ); |
69 | 71 | if ( count( $types ) >= 1 ) { |
70 | 72 | $typeDataValue = SMWDataValueFactory::newDataItemValue( current( $types ), $typeProperty ); |
71 | | - $typestring = $typeDataValue->getLongHTMLText( $skin ); |
| 73 | + $typestring = $typeDataValue->getLongHTMLText( $linker ); |
72 | 74 | } |
73 | | - $proplink = $skin->makeKnownLinkObj( $title, $result[0]->getLabel() ); |
| 75 | + $proplink = $linker->makeKnownLinkObj( $title, $result[0]->getLabel() ); |
74 | 76 | } elseif ( $result[0]->isUserDefined() && $title !== null ) { |
75 | 77 | $errors[] = wfMsg( 'smw_propertylackspage' ); |
76 | | - $proplink = $skin->makeBrokenLinkObj( $title, $result[0]->getLabel(), 'action=view' ); |
| 78 | + $proplink = $linker->makeBrokenLinkObj( $title, $result[0]->getLabel(), 'action=view' ); |
77 | 79 | } else { // predefined property |
78 | 80 | $typeid = $result[0]->findPropertyTypeID(); |
79 | 81 | $typeDataValue = SMWTypesValue::newFromTypeId( $typeid ); |
80 | 82 | $propertyDataValue = SMWDataValueFactory::newDataItemValue( $result[0], null ); |
81 | | - $typestring = $typeDataValue->getLongHTMLText( $skin ); |
| 83 | + $typestring = $typeDataValue->getLongHTMLText( $linker ); |
82 | 84 | if ( $typestring == '' ) $typestring = '–'; /// FIXME some types of builtin props have no name, and another message should be used then |
83 | | - $proplink = $propertyDataValue->getLongHTMLText( $skin ); |
| 85 | + $proplink = $propertyDataValue->getLongHTMLText( $linker ); |
84 | 86 | } |
85 | 87 | |
86 | 88 | if ( $typestring == '' ) { |
87 | 89 | global $smwgPDefaultType; |
88 | 90 | $typeDataValue = SMWTypesValue::newFromTypeId( $smwgPDefaultType ); |
89 | | - $typestring = $typeDataValue->getLongHTMLText( $skin ); |
| 91 | + $typestring = $typeDataValue->getLongHTMLText( $linker ); |
90 | 92 | if ( $title !== null && $title->exists() ) { // print only when we did not print a "nopage" warning yet |
91 | 93 | $errors[] = wfMsg( 'smw_propertylackstype', $typestring ); |
92 | 94 | } |
Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialWantedProperties.php |
— | — | @@ -66,11 +66,14 @@ |
67 | 67 | } |
68 | 68 | |
69 | 69 | function formatResult( $skin, $result ) { |
| 70 | + $linker = smwfGetLinker(); |
| 71 | + |
70 | 72 | if ( $result[0]->isUserDefined() ) { |
71 | | - $proplink = $skin->makeLinkObj( $result[0]->getWikiPageValue()->getTitle(), htmlspecialchars( $result[0]->getWikiValue() ), 'action=view' ); |
| 73 | + $proplink = $linker->makeLinkObj( $result[0]->getWikiPageValue()->getTitle(), htmlspecialchars( $result[0]->getWikiValue() ), 'action=view' ); |
72 | 74 | } else { |
73 | | - $proplink = $result[0]->getLongHTMLText( $skin ); |
| 75 | + $proplink = $result[0]->getLongHTMLText( $linker ); |
74 | 76 | } |
| 77 | + |
75 | 78 | return wfMsgExt( 'smw_wantedproperty_template', array( 'parsemag' ), $proplink, $result[1] ); |
76 | 79 | } |
77 | 80 | |
Index: trunk/extensions/SemanticMediaWiki/specials/QueryPages/SMW_SpecialUnusedProperties.php |
— | — | @@ -67,7 +67,9 @@ |
68 | 68 | } |
69 | 69 | |
70 | 70 | function formatResult( $skin, /* SMWDIProperty */ $result ) { |
71 | | - $proplink = $skin->makeKnownLinkObj( |
| 71 | + $linker = smwfGetLinker(); |
| 72 | + |
| 73 | + $proplink = $linker->makeKnownLinkObj( |
72 | 74 | $result->getDiWikiPage()->getTitle(), |
73 | 75 | $result->getLabel() |
74 | 76 | ); |
— | — | @@ -76,10 +78,10 @@ |
77 | 79 | $errors = array(); |
78 | 80 | |
79 | 81 | if ( count( $types ) >= 1 ) { |
80 | | - $typestring = SMWDataValueFactory::newDataItemValue( current( $types ), new SMWDIProperty( '_TYPE' ) )->getLongHTMLText( $skin ); |
| 82 | + $typestring = SMWDataValueFactory::newDataItemValue( current( $types ), new SMWDIProperty( '_TYPE' ) )->getLongHTMLText( $linker ); |
81 | 83 | } else { |
82 | 84 | $type = SMWTypesValue::newFromTypeId( '_wpg' ); |
83 | | - $typestring = $type->getLongHTMLText( $skin ); |
| 85 | + $typestring = $type->getLongHTMLText( $linker ); |
84 | 86 | $errors[] = wfMsg( 'smw_propertylackstype', $type->getLongHTMLText() ); |
85 | 87 | } |
86 | 88 | |
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php |
— | — | @@ -100,14 +100,14 @@ |
101 | 101 | */ |
102 | 102 | private function displaySearchByProperty() { |
103 | 103 | global $wgOut, $smwgSearchByPropertyFuzzy; |
104 | | - $skin = $this->getSkin(); |
| 104 | + $linker = smwfGetLinker(); |
105 | 105 | |
106 | 106 | if ( $this->propertystring == '' ) { |
107 | 107 | return '<p>' . wfMsg( 'smw_sbv_docu' ) . "</p>\n"; |
108 | 108 | } |
109 | 109 | |
110 | 110 | if ( ( $this->value == null ) || !$this->value->isValid() ) { |
111 | | - return '<p>' . wfMsg( 'smw_sbv_novalue', $this->property->getShortHTMLText( $skin ) ) . "</p>\n"; |
| 111 | + return '<p>' . wfMsg( 'smw_sbv_novalue', $this->property->getShortHTMLText( $linker ) ) . "</p>\n"; |
112 | 112 | } |
113 | 113 | |
114 | 114 | $wgOut->setPagetitle( $this->property->getWikiValue() . ' ' . $this->value->getShortHTMLText( null ) ); |
— | — | @@ -119,12 +119,15 @@ |
120 | 120 | if ( ( $count < ( $this->limit / 3 ) ) && ( $this->value->isNumeric() ) && $smwgSearchByPropertyFuzzy ) { |
121 | 121 | $greater = $this->getNearbyResults( $count, true ); |
122 | 122 | $lesser = $this->getNearbyResults( $count, false ); |
| 123 | + |
123 | 124 | // Calculate how many greater and lesser results should be displayed |
124 | 125 | $cG = count( $greater ); |
125 | 126 | $cL = count( $lesser ); |
| 127 | + |
126 | 128 | if ( ( $cG + $cL + $count ) > $this->limit ) { |
127 | 129 | $l = $this->limit - $count; |
128 | 130 | $lhalf = round( $l / 2 ); |
| 131 | + |
129 | 132 | if ( $lhalf < $cG ) { |
130 | 133 | if ( $lhalf < $cL ) { |
131 | 134 | $cL = $lhalf; $cG = $lhalf; |
— | — | @@ -135,20 +138,24 @@ |
136 | 139 | $cL = $this->limit - ( $count + $cG ); |
137 | 140 | } |
138 | 141 | } |
| 142 | + |
139 | 143 | if ( ( $cG + $cL + $count ) == 0 ) |
140 | 144 | $html .= wfMsg( 'smw_result_noresults' ); |
141 | 145 | else { |
142 | | - $html .= wfMsg( 'smw_sbv_displayresultfuzzy', $this->property->getShortHTMLText( $skin ), $this->value->getShortHTMLText( $skin ) ) . "<br />\n"; |
| 146 | + $html .= wfMsg( 'smw_sbv_displayresultfuzzy', $this->property->getShortHTMLText( $linker ), $this->value->getShortHTMLText( $linker ) ) . "<br />\n"; |
143 | 147 | $html .= $this->displayResults( $lesser, $cL, false ); |
| 148 | + |
144 | 149 | if ( $count == 0 ) { |
145 | 150 | $html .= "          <em><strong><small>(" . $this->value->getLongHTMLText() . ")</small></strong></em>\n"; |
146 | 151 | } else { |
147 | 152 | $html .= $this->displayResults( $exact, $count, true, true ); |
148 | 153 | } |
| 154 | + |
149 | 155 | $html .= $this->displayResults( $greater, $cG ); |
150 | 156 | } |
151 | 157 | } else { |
152 | | - $html .= wfMsg( 'smw_sbv_displayresult', $this->property->getShortHTMLText( $skin ), $this->value->getShortHTMLText( $skin ) ) . "<br />\n"; |
| 158 | + $html .= wfMsg( 'smw_sbv_displayresult', $this->property->getShortHTMLText( $linker ), $this->value->getShortHTMLText( $linker ) ) . "<br />\n"; |
| 159 | + |
153 | 160 | if ( 0 == $count ) { |
154 | 161 | $html .= wfMsg( 'smw_result_noresults' ); |
155 | 162 | } else { |
— | — | @@ -160,6 +167,7 @@ |
161 | 168 | } |
162 | 169 | |
163 | 170 | $html .= '<p> </p>'; |
| 171 | + |
164 | 172 | return $html; |
165 | 173 | } |
166 | 174 | |
— | — | @@ -173,18 +181,16 @@ |
174 | 182 | * @return string HTML with the bullet list and a header |
175 | 183 | */ |
176 | 184 | private function displayResults( $results, $number = - 1, $first = true, $highlight = false ) { |
177 | | - $skin = $this->getSkin(); |
178 | | - |
179 | 185 | $html = "<ul>\n"; |
180 | 186 | |
181 | 187 | if ( !$first && ( $number > 0 ) ) while ( count( $results ) > $number ) array_shift( $results ); |
182 | 188 | while ( $results && $number != 0 ) { |
183 | 189 | $result = array_shift( $results ); |
184 | | - $thing = $result[0]->getLongHTMLText( $skin ); |
| 190 | + $thing = $result[0]->getLongHTMLText( smwfGetLinker() ); |
185 | 191 | $browselink = ( $result[0]->getTypeId() == '_wpg' ) ? |
186 | | - '  ' . SMWInfolink::newBrowsingLink( '+', $result[0]->getShortHTMLText() )->getHTML( $skin ):''; |
| 192 | + '  ' . SMWInfolink::newBrowsingLink( '+', $result[0]->getShortHTMLText() )->getHTML( smwfGetLinker() ):''; |
187 | 193 | $html .= '<li>' . $thing . $browselink; |
188 | | - if ( ( $this->value != $result[1] ) || $highlight ) $html .= " <em><small>(" . $result[1]->getLongHTMLText( $skin ) . ")</small></em>"; |
| 194 | + if ( ( $this->value != $result[1] ) || $highlight ) $html .= " <em><small>(" . $result[1]->getLongHTMLText( smwfGetLinker() ) . ")</small></em>"; |
189 | 195 | $html .= "</li>"; |
190 | 196 | if ( $highlight ) $html = "<strong>" . $html . "</strong>"; |
191 | 197 | $html .= "\n"; |
— | — | @@ -204,13 +210,14 @@ |
205 | 211 | */ |
206 | 212 | private function getNavigationBar( $count ) { |
207 | 213 | global $smwgQMaxInlineLimit; |
208 | | - $skin = $this->getSkin(); |
209 | 214 | |
210 | | - if ( $this->offset > 0 ) |
| 215 | + if ( $this->offset > 0 ) { |
211 | 216 | $navigation = '<a href="' . htmlspecialchars( $skin->makeSpecialUrl( 'SearchByProperty', 'offset=' . max( 0, $this->offset - $this->limit ) . '&limit=' . $this->limit . '&property=' . urlencode( $this->property->getWikiValue() ) . '&value=' . urlencode( $this->value->getWikiValue() ) ) ) . '">' . wfMsg( 'smw_result_prev' ) . '</a>'; |
212 | | - else |
| 217 | + } |
| 218 | + else { |
213 | 219 | $navigation = wfMsg( 'smw_result_prev' ); |
214 | | - |
| 220 | + } |
| 221 | + |
215 | 222 | $navigation .= '     <b>' . wfMsg( 'smw_result_results' ) . ' ' . ( $this->offset + 1 ) . '– ' . ( $this->offset + min( $count, $this->limit ) ) . '</b>    '; |
216 | 223 | |
217 | 224 | if ( $count > $this->limit ) { |
— | — | @@ -219,25 +226,31 @@ |
220 | 227 | $navigation .= wfMsg( 'smw_result_next' ); |
221 | 228 | } |
222 | 229 | |
223 | | - $max = false; $first = true; |
| 230 | + $max = false; |
| 231 | + $first = true; |
| 232 | + |
224 | 233 | foreach ( array( 20, 50, 100, 250, 500 ) as $l ) { |
225 | 234 | if ( $max ) continue; |
| 235 | + |
226 | 236 | if ( $first ) { |
227 | 237 | $navigation .= '        ('; |
228 | 238 | $first = false; |
229 | 239 | } else { |
230 | 240 | $navigation .= ' ' . wfMsgExt( 'pipe-separator' , 'escapenoentities' ) . ' '; |
231 | 241 | } |
| 242 | + |
232 | 243 | if ( $l > $smwgQMaxInlineLimit ) { |
233 | 244 | $l = $smwgQMaxInlineLimit; |
234 | 245 | $max = true; |
235 | 246 | } |
| 247 | + |
236 | 248 | if ( $this->limit != $l ) { |
237 | 249 | $navigation .= '<a href="' . htmlspecialchars( $skin->makeSpecialUrl( 'SearchByProperty', 'offset=' . $this->offset . '&limit=' . $l . '&property=' . urlencode( $this->property->getWikiValue() ) . '&value=' . urlencode( $this->value->getWikiValue() ) ) ) . '">' . $l . '</a>'; |
238 | 250 | } else { |
239 | 251 | $navigation .= '<b>' . $l . '</b>'; |
240 | 252 | } |
241 | 253 | } |
| 254 | + |
242 | 255 | $navigation .= ')'; |
243 | 256 | return $navigation; |
244 | 257 | } |
— | — | @@ -327,21 +340,4 @@ |
328 | 341 | return $html; |
329 | 342 | } |
330 | 343 | |
331 | | - /** |
332 | | - * Compatibility method to get the skin; MW 1.18 introduces a getSkin method in SpecialPage. |
333 | | - * |
334 | | - * @since 1.6 |
335 | | - * |
336 | | - * @return Skin |
337 | | - */ |
338 | | - public function getSkin() { |
339 | | - if ( method_exists( 'SpecialPage', 'getSkin' ) ) { |
340 | | - return parent::getSkin(); |
341 | | - } |
342 | | - else { |
343 | | - global $wgUser; |
344 | | - return $wgUser->getSkin(); |
345 | | - } |
346 | | - } |
347 | | - |
348 | 344 | } |
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php |
— | — | @@ -201,16 +201,16 @@ |
202 | 202 | * @return string HTML with the link to the article, browse, and search pages |
203 | 203 | */ |
204 | 204 | private function displayValue( SMWPropertyValue $property, SMWDataValue $dataValue, $incoming ) { |
205 | | - $skin = $this->getSkin(); |
| 205 | + $linker = smwfGetLinker(); |
206 | 206 | |
207 | | - $html = $dataValue->getLongHTMLText( $skin ); |
| 207 | + $html = $dataValue->getLongHTMLText( $linker ); |
208 | 208 | |
209 | 209 | if ( $dataValue->getTypeID() == '_wpg' ) { |
210 | | - $html .= " " . SMWInfolink::newBrowsingLink( '+', $dataValue->getLongWikiText() )->getHTML( $skin ); |
| 210 | + $html .= " " . SMWInfolink::newBrowsingLink( '+', $dataValue->getLongWikiText() )->getHTML( $linker ); |
211 | 211 | } elseif ( $incoming && $property->isVisible() ) { |
212 | | - $html .= " " . SMWInfolink::newInversePropertySearchLink( '+', $dataValue->getTitle(), $property->getText(), 'smwsearch' )->getHTML( $skin ); |
| 212 | + $html .= " " . SMWInfolink::newInversePropertySearchLink( '+', $dataValue->getTitle(), $property->getText(), 'smwsearch' )->getHTML( $linker ); |
213 | 213 | } else { |
214 | | - $html .= $dataValue->getInfolinkText( SMW_OUTPUT_HTML, $skin ); |
| 214 | + $html .= $dataValue->getInfolinkText( SMW_OUTPUT_HTML, $linker ); |
215 | 215 | } |
216 | 216 | |
217 | 217 | return $html; |
— | — | @@ -376,21 +376,4 @@ |
377 | 377 | return $count > 2 ? preg_replace( '/($nonBreakingSpace)/u', ' ', $text, max( 0, $count - 2 ) ):$text; |
378 | 378 | } |
379 | 379 | |
380 | | - /** |
381 | | - * Compatibility method to get the skin; MW 1.18 introduces a getSkin method in SpecialPage. |
382 | | - * |
383 | | - * @since 1.6 |
384 | | - * |
385 | | - * @return Skin |
386 | | - */ |
387 | | - public function getSkin() { |
388 | | - if ( method_exists( 'SpecialPage', 'getSkin' ) ) { |
389 | | - return parent::getSkin(); |
390 | | - } |
391 | | - else { |
392 | | - global $wgUser; |
393 | | - return $wgUser->getSkin(); |
394 | | - } |
395 | | - } |
396 | | - |
397 | 380 | } |
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialPageProperty.php |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | |
33 | 33 | public function execute( $query ) { |
34 | 34 | global $wgRequest, $wgOut; |
35 | | - $skin = $this->getSkin(); |
| 35 | + $linker = smwfGetLinker(); |
36 | 36 | $this->setHeaders(); |
37 | 37 | |
38 | 38 | // Get parameters |
— | — | @@ -72,14 +72,41 @@ |
73 | 73 | // prepare navigation bar if needed |
74 | 74 | if ( ( $offset > 0 ) || ( count( $results ) > $limit ) ) { |
75 | 75 | if ( $offset > 0 ) { |
76 | | - $navigation = '<a href="' . htmlspecialchars( $skin->makeSpecialUrl( 'PageProperty', 'offset=' . max( 0, $offset - $limit ) . '&limit=' . $limit . '&type=' . urlencode( $propname ) . '&from=' . urlencode( $pagename ) ) ) . '">' . wfMsg( 'smw_result_prev' ) . '</a>'; |
| 76 | + $navigation = Html::element( |
| 77 | + 'a', |
| 78 | + array( |
| 79 | + 'href' => SpecialPage::getSafeTitleFor( 'PageProperty' )->getLocalURL( |
| 80 | + 'offset=' . max( 0, $offset - $limit ) . |
| 81 | + '&limit=' . $limit . |
| 82 | + '&type=' . urlencode( $propname ) . |
| 83 | + '&from=' . urlencode( $pagename ) |
| 84 | + ) |
| 85 | + ), |
| 86 | + wfMsg( 'smw_result_prev' ) |
| 87 | + ); |
77 | 88 | } else { |
78 | 89 | $navigation = wfMsg( 'smw_result_prev' ); |
79 | 90 | } |
80 | 91 | |
81 | | - $navigation .= '     <b>' . wfMsg( 'smw_result_results' ) . ' ' . ( $offset + 1 ) . '– ' . ( $offset + min( count( $results ), $limit ) ) . '</b>    '; |
| 92 | + $navigation .= |
| 93 | + '     <b>' . |
| 94 | + wfMsg( 'smw_result_results' ) . ' ' . |
| 95 | + ( $offset + 1 ) . '– ' . ( $offset + min( count( $results ), $limit ) ) . |
| 96 | + '</b>    '; |
| 97 | + |
82 | 98 | if ( count( $results ) == ( $limit + 1 ) ) { |
83 | | - $navigation .= ' <a href="' . htmlspecialchars( $skin->makeSpecialUrl( 'PageProperty', 'offset=' . ( $offset + $limit ) . '&limit=' . $limit . '&type=' . urlencode( $propname ) . '&from=' . urlencode( $pagename ) ) ) . '">' . wfMsg( 'smw_result_next' ) . '</a>'; |
| 99 | + $navigation = Html::element( |
| 100 | + 'a', |
| 101 | + array( |
| 102 | + 'href' => SpecialPage::getSafeTitleFor( 'PageProperty' )->getLocalURL( |
| 103 | + 'offset=' . ( $offset + $limit ) . |
| 104 | + '&limit=' . $limit . |
| 105 | + '&type=' . urlencode( $propname ) . |
| 106 | + '&from=' . urlencode( $pagename ) |
| 107 | + ) |
| 108 | + ), |
| 109 | + wfMsg( 'smw_result_next' ) |
| 110 | + ); |
84 | 111 | } else { |
85 | 112 | $navigation .= wfMsg( 'smw_result_next' ); |
86 | 113 | } |
— | — | @@ -98,10 +125,10 @@ |
99 | 126 | $count--; |
100 | 127 | if ( $count < 1 ) continue; |
101 | 128 | $dv = SMWDataValueFactory::newDataItemValue( $di, $property->getDataItem() ); |
102 | | - $html .= '<li>' . $dv->getLongHTMLText( $skin ); // do not show infolinks, the magnifier "+" is ambiguous with the browsing '+' for '_wpg' (see below) |
| 129 | + $html .= '<li>' . $dv->getLongHTMLText( $linker ); // do not show infolinks, the magnifier "+" is ambiguous with the browsing '+' for '_wpg' (see below) |
103 | 130 | if ( $property->getDataItem()->findPropertyTypeID() == '_wpg' ) { |
104 | 131 | $browselink = SMWInfolink::newBrowsingLink( '+', $dv->getLongWikiText() ); |
105 | | - $html .= '  ' . $browselink->getHTML( $skin ); |
| 132 | + $html .= '  ' . $browselink->getHTML( $linker ); |
106 | 133 | } |
107 | 134 | $html .= "</li> \n"; |
108 | 135 | } |
— | — | @@ -123,21 +150,4 @@ |
124 | 151 | SMWOutputs::commitToOutputPage( $wgOut ); // make sure locally collected output data is pushed to the output! |
125 | 152 | } |
126 | 153 | |
127 | | - /** |
128 | | - * Compatibility method to get the skin; MW 1.18 introduces a getSkin method in SpecialPage. |
129 | | - * |
130 | | - * @since 1.6 |
131 | | - * |
132 | | - * @return Skin |
133 | | - */ |
134 | | - public function getSkin() { |
135 | | - if ( method_exists( 'SpecialPage', 'getSkin' ) ) { |
136 | | - return parent::getSkin(); |
137 | | - } |
138 | | - else { |
139 | | - global $wgUser; |
140 | | - return $wgUser->getSkin(); |
141 | | - } |
142 | | - } |
143 | | - |
144 | 154 | } |