Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUI.php |
— | — | @@ -171,16 +171,12 @@ |
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
175 | | - * Enable auto completion scripts and styles for the current output |
176 | | - * page $wgOut. |
177 | | - * |
178 | | - * @global OutputPage $wgOut |
| 175 | + * Enable auto completion scripts and styles. |
179 | 176 | */ |
180 | 177 | protected function enableAutocompletion() { |
181 | | - global $wgOut; |
182 | | - if ( $this->autoCompleteEnabled == false ) { |
183 | | - SMWOutputs::requireResource( 'jquery.ui.autocomplete' ); |
184 | | - $javascriptAutocompleteText = <<<END |
| 178 | + SMWOutputs::requireResource( 'jquery.ui.autocomplete' ); |
| 179 | + |
| 180 | + $javascriptAutocompleteText = <<<END |
185 | 181 | <script type="text/javascript"> |
186 | 182 | function smw_split( val ) { |
187 | 183 | return val.split( '\\n' ); |
— | — | @@ -226,9 +222,8 @@ |
227 | 223 | </script> |
228 | 224 | END; |
229 | 225 | |
230 | | - $wgOut->addScript( $javascriptAutocompleteText ); |
231 | | - $this->autoCompleteEnabled = true; |
232 | | - } |
| 226 | + SMWOutputs::requireScript( 'smwAutocompleteQueryUICore', $javascriptAutocompleteText ); |
| 227 | + |
233 | 228 | } |
234 | 229 | |
235 | 230 | /** |
— | — | @@ -326,12 +321,11 @@ |
327 | 322 | * complement processQueryFormBox() to decode data sent through these elements. |
328 | 323 | * UI's may overload both to change form parameters. |
329 | 324 | * |
330 | | - * @global OutputPage $wgOut |
331 | 325 | * @global string $smwgScriptPath |
332 | 326 | * @return string |
333 | 327 | */ |
334 | 328 | protected function getQueryFormBox() { |
335 | | - global $wgOut, $smwgScriptPath; |
| 329 | + global $smwgScriptPath; |
336 | 330 | $this->setUrlArgs( array( 'q' => $this->uiCore->getQueryString() ) ); |
337 | 331 | $result = '<div>' . |
338 | 332 | Html::element( 'textarea', |
— | — | @@ -499,14 +493,13 @@ |
500 | 494 | * @global boolean $smwgQSortingSupport |
501 | 495 | * @global boolean $smwgQRandSortingSupport |
502 | 496 | * @global WebRequest $wgRequest |
503 | | - * @global OutputPage $wgOut |
504 | 497 | * @global string $smwgScriptPath |
505 | 498 | * @global integer $smwgQPrintoutLimit |
506 | 499 | * @param mixed $enableAutocomplete |
507 | 500 | * @return string |
508 | 501 | */ |
509 | 502 | protected function getPoSortFormBox( $enableAutocomplete = SMWQueryUI::ENABLE_AUTO_SUGGEST ) { |
510 | | - global $smwgQSortingSupport, $wgRequest, $wgOut, $smwgScriptPath; |
| 503 | + global $smwgQSortingSupport, $wgRequest, $smwgScriptPath; |
511 | 504 | global $smwgQRandSortingSupport, $smwgQPrintoutLimit; |
512 | 505 | |
513 | 506 | SMWOutputs::requireResource( 'jquery.ui.autocomplete' ); |
— | — | @@ -1407,7 +1400,7 @@ |
1408 | 1401 | |
1409 | 1402 | EOT; |
1410 | 1403 | |
1411 | | - $wgOut->addScript( $javascriptText ); |
| 1404 | + SMWOutputs::requireScript( 'smwAutocompleteQueryUI', $javascriptText ); |
1412 | 1405 | $result .= '</span>'; |
1413 | 1406 | return $result; |
1414 | 1407 | } |
— | — | @@ -1419,13 +1412,12 @@ |
1420 | 1413 | * |
1421 | 1414 | * @global boolean $smwgQSortingSupport |
1422 | 1415 | * @global WebRequest $wgRequest |
1423 | | - * @global OutputPage $wgOut |
1424 | 1416 | * @return string |
1425 | 1417 | * |
1426 | 1418 | * @todo This code is not used anywhere in SMW. |
1427 | 1419 | */ |
1428 | 1420 | protected function getSortingFormBox() { |
1429 | | - global $smwgQSortingSupport, $wgRequest, $wgOut; |
| 1421 | + global $smwgQSortingSupport, $wgRequest; |
1430 | 1422 | |
1431 | 1423 | if ( !$smwgQSortingSupport ) return ''; |
1432 | 1424 | $params = $this->uiCore->getParameters(); |
— | — | @@ -1523,7 +1515,7 @@ |
1524 | 1516 | |
1525 | 1517 | EOT; |
1526 | 1518 | |
1527 | | - $wgOut->addScript( $javascriptText ); |
| 1519 | + SMWOutputs::requireScript( 'smwPrintoutControlsQueryUI', $javascriptText ); |
1528 | 1520 | return $result; |
1529 | 1521 | } |
1530 | 1522 | |
— | — | @@ -1574,8 +1566,6 @@ |
1575 | 1567 | * @return string The HTML code |
1576 | 1568 | */ |
1577 | 1569 | protected function getPOFormBox( $enableAutocomplete = SMWQueryUI::ENABLE_AUTO_SUGGEST ) { |
1578 | | - global $wgOut; |
1579 | | - |
1580 | 1570 | if ( $enableAutocomplete ) { |
1581 | 1571 | $this->enableAutocompletion(); |
1582 | 1572 | $javascriptAutocompleteText = <<<EOT |
— | — | @@ -1613,7 +1603,7 @@ |
1614 | 1604 | </script> |
1615 | 1605 | EOT; |
1616 | 1606 | |
1617 | | - $wgOut->addScript( $javascriptAutocompleteText ); |
| 1607 | + SMWOutputs::requireScript( 'smwPrintoutAutocompleteQueryUI', $javascriptAutocompleteText ); |
1618 | 1608 | |
1619 | 1609 | } |
1620 | 1610 | $this->setUrlArgs( array( 'po' => $this->getPOStrings() ) ); |
— | — | @@ -1790,7 +1780,7 @@ |
1791 | 1781 | * @return array The first element contains the format selector, while the second contains the Format options |
1792 | 1782 | */ |
1793 | 1783 | protected function getFormatSelectBoxSep( $defaultFormat = 'broadtable' ) { |
1794 | | - global $smwgResultFormats, $wgOut; |
| 1784 | + global $smwgResultFormats; |
1795 | 1785 | |
1796 | 1786 | SMWOutputs::requireResource( 'jquery' ); |
1797 | 1787 | |
— | — | @@ -1843,7 +1833,7 @@ |
1844 | 1834 | </script> |
1845 | 1835 | END; |
1846 | 1836 | |
1847 | | - $wgOut->addScript( $javascript ); |
| 1837 | + SMWOutputs::requireScript( 'smwUpdateOptionsQueryUI', $javascript ); |
1848 | 1838 | // END: add javascript for updating formating options by ajax |
1849 | 1839 | |
1850 | 1840 | return $result; |
Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php |
— | — | @@ -102,13 +102,9 @@ |
103 | 103 | /** |
104 | 104 | * Create the search form. |
105 | 105 | * |
106 | | - * @global OutputPage $wgOut |
107 | | - * @global string $smwgScriptPath |
108 | 106 | * @return string HTML code for search form |
109 | 107 | */ |
110 | 108 | protected function makeForm() { |
111 | | - global $wgOut, $smwgScriptPath; |
112 | | - |
113 | 109 | SMWOutputs::requireResource( 'jquery' ); |
114 | 110 | |
115 | 111 | $specTitle = $this->getTitle(); |
— | — | @@ -185,7 +181,7 @@ |
186 | 182 | } ); |
187 | 183 | </script> |
188 | 184 | EOT; |
189 | | - $wgOut->addScript( $javascriptText ); |
| 185 | + SMWOutputs::requireScript( 'smwToggleAskSyntaxQC', $javascriptText ); |
190 | 186 | } |
191 | 187 | |
192 | 188 | $result .= '<input type="hidden" name="eq" value="no"/>' . |
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php |
— | — | @@ -416,8 +416,6 @@ |
417 | 417 | * |
418 | 418 | */ |
419 | 419 | protected static function addAutoComplete() { |
420 | | - global $wgOut; |
421 | | - |
422 | 420 | SMWOutputs::requireResource( 'jquery.ui.autocomplete' ); |
423 | 421 | |
424 | 422 | $javascript_autocomplete_text = <<<END |
— | — | @@ -438,7 +436,7 @@ |
439 | 437 | |
440 | 438 | END; |
441 | 439 | |
442 | | - $wgOut->addScript( $javascript_autocomplete_text ); |
| 440 | + SMWOutputs::requireScript( 'smwAutocompleteSpecialSearchByProperty', $javascript_autocomplete_text ); |
443 | 441 | } |
444 | 442 | |
445 | 443 | } |
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php |
— | — | @@ -393,8 +393,6 @@ |
394 | 394 | * MW API to fetch suggestions. |
395 | 395 | */ |
396 | 396 | private static function addAutoComplete(){ |
397 | | - global $wgOut; |
398 | | - |
399 | 397 | SMWOutputs::requireResource( 'jquery.ui.autocomplete' ); |
400 | 398 | |
401 | 399 | $javascript_autocomplete_text = <<<END |
— | — | @@ -413,7 +411,7 @@ |
414 | 412 | |
415 | 413 | END; |
416 | 414 | |
417 | | - $wgOut->addScript( $javascript_autocomplete_text ); |
| 415 | + SMWOutputs::requireScript( 'smwAutocompleteSpecialBrowse', $javascript_autocomplete_text ); |
418 | 416 | } |
419 | 417 | |
420 | 418 | /** |