Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php |
— | — | @@ -361,7 +361,7 @@ |
362 | 362 | $result_mime = false; // output in MW Special page as usual |
363 | 363 | |
364 | 364 | // build parameter strings for URLs, based on current settings |
365 | | - $urltail = '&q=' . urlencode( $this->m_querystring ); |
| 365 | + $urlArgs['q'] = $this->m_querystring; |
366 | 366 | |
367 | 367 | $tmp_parray = array(); |
368 | 368 | foreach ( $this->m_params as $key => $value ) { |
— | — | @@ -370,16 +370,16 @@ |
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | | - $urltail .= '&p=' . urlencode( SMWInfolink::encodeParameters( $tmp_parray ) ); |
| 374 | + $urlArgs['p'] = SMWInfolink::encodeParameters( $tmp_parray ); |
375 | 375 | $printoutstring = ''; |
376 | 376 | |
377 | 377 | foreach ( $this->m_printouts as $printout ) { |
378 | 378 | $printoutstring .= $printout->getSerialisation() . "\n"; |
379 | 379 | } |
380 | 380 | |
381 | | - if ( $printoutstring != '' ) $urltail .= '&po=' . urlencode( $printoutstring ); |
382 | | - if ( array_key_exists( 'sort', $this->m_params ) ) $urltail .= '&sort=' . $this->m_params['sort']; |
383 | | - if ( array_key_exists( 'order', $this->m_params ) ) $urltail .= '&order=' . $this->m_params['order']; |
| 381 | + if ( $printoutstring != '' ) $urlArgs['po'] = $printoutstring; |
| 382 | + if ( array_key_exists( 'sort', $this->m_params ) ) $urlArgs['sort'] = $this->m_params['sort']; |
| 383 | + if ( array_key_exists( 'order', $this->m_params ) ) $urlArgs['order'] = $this->m_params['order']; |
384 | 384 | |
385 | 385 | if ( $this->m_querystring != '' ) { |
386 | 386 | $queryobj = SMWQueryProcessor::createQuery( $this->m_querystring, $this->m_params, SMWQueryProcessor::SPECIAL_PAGE , $this->m_params['format'], $this->m_printouts ); |
— | — | @@ -425,10 +425,14 @@ |
426 | 426 | |
427 | 427 | if ( $result_mime == false ) { |
428 | 428 | if ( $res->getCount() > 0 ) { |
429 | | - if ( $this->m_editquery ) $urltail .= '&eq=yes'; |
430 | | - if ( $hidequery ) $urltail .= '&eq=no'; |
| 429 | + if ( $this->m_editquery ) { |
| 430 | + $urlArgs['eq'] = 'yes'; |
| 431 | + } |
| 432 | + else if ( $hidequery ) { |
| 433 | + $urlArgs['eq'] = 'no'; |
| 434 | + } |
431 | 435 | |
432 | | - $navigation = $this->getNavigationBar( $res, $urltail ); |
| 436 | + $navigation = $this->getNavigationBar( $res, $urlArgs ); |
433 | 437 | $result .= '<div style="text-align: center;">' . "\n" . $navigation . "\n</div>\n"; |
434 | 438 | $query_result = $printer->getResult( $res, $this->m_params, SMW_OUTPUT_HTML ); |
435 | 439 | |
— | — | @@ -440,7 +444,7 @@ |
441 | 445 | |
442 | 446 | $result .= '<div style="text-align: center;">' . "\n" . $navigation . "\n</div>\n"; |
443 | 447 | } else { |
444 | | - $result = '<div style="text-align: center;">' . wfMsg( 'smw_result_noresults' ) . '</div>'; |
| 448 | + $result = '<div style="text-align: center;">' . wfMsgHtml( 'smw_result_noresults' ) . '</div>'; |
445 | 449 | } |
446 | 450 | } else { // make a stand-alone file |
447 | 451 | $result = $printer->getResult( $res, $this->m_params, SMW_OUTPUT_FILE ); |
— | — | @@ -455,7 +459,13 @@ |
456 | 460 | $wgOut->setHTMLtitle( wfMsg( 'ask' ) ); |
457 | 461 | } |
458 | 462 | |
459 | | - $result = $this->getInputForm( $printoutstring, 'offset=' . $this->m_params['offset'] . '&limit=' . $this->m_params['limit'] . $urltail ) . $result; |
| 463 | + $result = $this->getInputForm( |
| 464 | + $printoutstring, |
| 465 | + 'offset=' . $this->m_params['offset'] |
| 466 | + . '&limit=' . $this->m_params['limit'] |
| 467 | + . wfArrayToCGI( $urlArgs ) |
| 468 | + ) . $result; |
| 469 | + |
460 | 470 | $wgOut->addHTML( $result ); |
461 | 471 | } else { |
462 | 472 | $wgOut->disable(); |
— | — | @@ -560,7 +570,7 @@ |
561 | 571 | $result .= '<fieldset><legend>' . wfMsg( 'smw_ask_otheroptions' ) . "</legend>\n"; |
562 | 572 | $result .= "<div id=\"other_options\">" . $this->showFormatOptions( $this->m_params['format'], $this->m_params ) . "</div>"; |
563 | 573 | $result .= "</fieldset>\n"; |
564 | | - $urltail = str_replace( '&eq=yes', '', $urltail ) . '&eq=no'; |
| 574 | + $urltail = str_replace( '&eq=yes', '', $urltail ) . '&eq=no'; // FIXME: doing it wrong, srysly |
565 | 575 | |
566 | 576 | $result .= '<br /><input type="submit" value="' . wfMsg( 'smw_ask_submit' ) . '"/>' . |
567 | 577 | '<input type="hidden" name="eq" value="yes"/>' . |
— | — | @@ -629,11 +639,11 @@ |
630 | 640 | * Build the navigation for some given query result, reuse url-tail parameters. |
631 | 641 | * |
632 | 642 | * @param SMWQueryResult $res |
633 | | - * @param string $urltail |
| 643 | + * @param array $urlArgs |
634 | 644 | * |
635 | 645 | * @return string |
636 | 646 | */ |
637 | | - protected function getNavigationBar( SMWQueryResult $res, $urltail ) { |
| 647 | + protected function getNavigationBar( SMWQueryResult $res, array $urlArgs ) { |
638 | 648 | global $smwgQMaxInlineLimit; |
639 | 649 | |
640 | 650 | $offset = $this->m_params['offset']; |
— | — | @@ -646,8 +656,8 @@ |
647 | 657 | array( |
648 | 658 | 'href' => SpecialPage::getSafeTitleFor( 'Ask' )->getLocalURL( array( |
649 | 659 | 'offset' => max( 0, $offset - $limit ), |
650 | | - 'limit' => $limit . $urltail |
651 | | - ) ), |
| 660 | + 'limit' => $limit |
| 661 | + ) + $urlArgs ), |
652 | 662 | 'rel' => 'nofollow' |
653 | 663 | ), |
654 | 664 | wfMsg( 'smw_result_prev' ) |
— | — | @@ -670,8 +680,8 @@ |
671 | 681 | array( |
672 | 682 | 'href' => SpecialPage::getSafeTitleFor( 'Ask' )->getLocalURL( array( |
673 | 683 | 'offset' => ( $offset + $limit ), |
674 | | - 'limit' => $limit . $urltail |
675 | | - ) ), |
| 684 | + 'limit' => $limit |
| 685 | + ) + $urlArgs ), |
676 | 686 | 'rel' => 'nofollow' |
677 | 687 | ), |
678 | 688 | wfMsg( 'smw_result_next' ) |
— | — | @@ -698,8 +708,8 @@ |
699 | 709 | array( |
700 | 710 | 'href' => SpecialPage::getSafeTitleFor( 'Ask' )->getLocalURL( array( |
701 | 711 | 'offset' => $offset, |
702 | | - 'limit' => $l . $urltail |
703 | | - ) ), |
| 712 | + 'limit' => $l |
| 713 | + ) + $urlArgs ), |
704 | 714 | 'rel' => 'nofollow' |
705 | 715 | ), |
706 | 716 | $l |