Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php |
— | — | @@ -47,7 +47,6 @@ |
48 | 48 | * @global WebRequest $wgRequest |
49 | 49 | * @global boolean $smwgQEnabled |
50 | 50 | * @param string $p the sub-page string |
51 | | - * @todo: using processXXXBox() methods here goes against the general architecture. Move this to the UI implementation |
52 | 51 | */ |
53 | 52 | public function execute( $p ) { |
54 | 53 | global $wgOut, $wgRequest, $smwgQEnabled, $wgFeedClasses; |
— | — | @@ -63,13 +62,7 @@ |
64 | 63 | // the 'q' is dependent from the form parameter set by getQueryFormBox() |
65 | 64 | // and processQueryFormBox() |
66 | 65 | if ( $wgRequest->getCheck( 'q' ) ) { |
67 | | - $params = array_merge( |
68 | | - array( |
69 | | - 'format' => $wgRequest->getVal( 'format' ), |
70 | | - 'offset' => $wgRequest->getVal( 'offset', '0' ), |
71 | | - 'limit' => $wgRequest->getVal( 'limit', '20' ) ), |
72 | | - $this->processPoSortFormBox( $wgRequest ), |
73 | | - $this->processFormatSelectBox( $wgRequest ) ); |
| 66 | + $params = $this->processParams(); |
74 | 67 | $this->uiCore = SMWQueryUIHelper::makeForUI( |
75 | 68 | $this->processQueryFormBox( $wgRequest ), |
76 | 69 | $params, |
— | — | @@ -84,10 +77,10 @@ |
85 | 78 | $this->uiCore = SMWQueryUIHelper::makeForInfoLink( $p ); |
86 | 79 | } |
87 | 80 | // adding rss feed of results to the page head |
88 | | - if ( ( $this->uiCore->getQueryString() !== '' ) |
89 | | - and ( $this->isSyndicated() ) |
90 | | - and ( method_exists( $wgOut, 'addFeedlink' ) ) // remove this line after MW 1.5 is no longer supported by SMW |
91 | | - and ( array_key_exists( 'rss', $wgFeedClasses ) ) ) { |
| 81 | + if ( ( $this->isSyndicated() ) |
| 82 | + && ( $this->uiCore->getQueryString() !== '' ) |
| 83 | + && ( method_exists( $wgOut, 'addFeedlink' ) ) // remove this line after MW 1.5 is no longer supported by SMW |
| 84 | + && ( array_key_exists( 'rss', $wgFeedClasses ) ) ) { |
92 | 85 | $res = $this->uiCore->getResultObject(); |
93 | 86 | $link = $res->getQueryLink(); |
94 | 87 | $link->setParameter( 'rss', 'format' ); |
— | — | @@ -103,6 +96,16 @@ |
104 | 97 | } |
105 | 98 | |
106 | 99 | /** |
| 100 | + * This method should call the various processXXXBox() methods for each of |
| 101 | + * the corresponding getXXXBox() methods which the UI uses. |
| 102 | + * Merge the results of these methods and return them. |
| 103 | + * |
| 104 | + * @global WebRequest $wgRequest |
| 105 | + * @return array |
| 106 | + */ |
| 107 | + protected abstract function processParams(); |
| 108 | + |
| 109 | + /** |
107 | 110 | * To enable/disable syndicated feeds of results to appear in the UI header |
108 | 111 | * |
109 | 112 | * @return boolean |
— | — | @@ -691,19 +694,19 @@ |
692 | 695 | $result .= Xml::checkLabel( wfMsg( 'smw_qui_shownresults' ), "display[$i]", "display$i", $if4 ); |
693 | 696 | |
694 | 697 | if ( is_array( $propertyLabelValues ) && array_key_exists( $key, $propertyLabelValues ) ) { |
695 | | - $result .= Xml::hidden( "prop_label[$i]", $propertyLabelValues[$key], array( 'id' => "prop_label$i" ) ); |
| 698 | + $result .= Html::hidden( "prop_label[$i]", $propertyLabelValues[$key], array( 'id' => "prop_label$i" ) ); |
696 | 699 | } else { |
697 | | - $result .= Xml::hidden( "prop_label[$i]", '', array( 'id' => "prop_label$i" ) ); |
| 700 | + $result .= Html::hidden( "prop_label[$i]", '', array( 'id' => "prop_label$i" ) ); |
698 | 701 | } |
699 | 702 | if ( is_array( $propertyFormatValues ) && array_key_exists( $key, $propertyFormatValues ) ) { |
700 | | - $result .= Xml::hidden( "prop_format[$i]", $propertyFormatValues[$key], array( 'id' => "prop_format$i" ) ); |
| 703 | + $result .= Html::hidden( "prop_format[$i]", $propertyFormatValues[$key], array( 'id' => "prop_format$i" ) ); |
701 | 704 | } else { |
702 | | - $result .= Xml::hidden( "prop_format[$i]", '', array( 'id' => "prop_format$i" ) ); |
| 705 | + $result .= Html::hidden( "prop_format[$i]", '', array( 'id' => "prop_format$i" ) ); |
703 | 706 | } |
704 | 707 | if ( is_array( $propertyLimitValues ) && array_key_exists( $key, $propertyLimitValues ) ) { |
705 | | - $result .= Xml::hidden( "prop_limit[$i]", $propertyLimitValues[$key], array( 'id' => "prop_limit$i" ) ); |
| 708 | + $result .= Html::hidden( "prop_limit[$i]", $propertyLimitValues[$key], array( 'id' => "prop_limit$i" ) ); |
706 | 709 | } else { |
707 | | - $result .= Xml::hidden( "prop_limit[$i]", '', array( 'id' => "prop_limit$i" ) ); |
| 710 | + $result .= Html::hidden( "prop_limit[$i]", '', array( 'id' => "prop_limit$i" ) ); |
708 | 711 | } |
709 | 712 | $result .= ' <a id="more' . $i . '" "class="smwq-more" href="javascript:smw_makePropDialog(\'' . $i . '\')"> ' . WfMsg( 'smw_qui_options' ) . ' </a> '; |
710 | 713 | |
— | — | @@ -753,9 +756,9 @@ |
754 | 757 | Xml::option( wfMsg( 'smw_qui_ascorder' ), 'ASC' ) . |
755 | 758 | Xml::option( wfMsg( 'smw_qui_descorder' ), 'DESC' ) . |
756 | 759 | Xml::closeElement( 'select' ) . |
757 | | - Xml::hidden( 'prop_label_num', '' ) . |
758 | | - Xml::hidden( 'prop_format_num', '' ) . |
759 | | - Xml::hidden( 'prop_limit_num', '' ) . |
| 760 | + Html::hidden( 'prop_label_num', '' ) . |
| 761 | + Html::hidden( 'prop_format_num', '' ) . |
| 762 | + Html::hidden( 'prop_limit_num', '' ) . |
760 | 763 | Xml::checkLabel( wfMsg( 'smw_qui_shownresults' ), "display_num", '', true ) . |
761 | 764 | Xml::closeElement( 'div' ); |
762 | 765 | $hiddenProperty = json_encode( $hiddenProperty ); |
Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php |
— | — | @@ -53,6 +53,26 @@ |
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
| 57 | + * This method should call the various processXXXBox() methods for each of |
| 58 | + * the corresponding getXXXBox() methods which the UI uses. |
| 59 | + * Merge the results of these methods and return them. |
| 60 | + * |
| 61 | + * @global WebRequest $wgRequest |
| 62 | + * @return array |
| 63 | + */ |
| 64 | + protected function processParams(){ |
| 65 | + global $wgRequest; |
| 66 | + $params = array_merge( |
| 67 | + array( |
| 68 | + 'format' => $wgRequest->getVal( 'format' ), |
| 69 | + 'offset' => $wgRequest->getVal( 'offset', '0' ), |
| 70 | + 'limit' => $wgRequest->getVal( 'limit', '20' ) ), |
| 71 | + $this->processPoSortFormBox( $wgRequest ), |
| 72 | + $this->processFormatSelectBox( $wgRequest ) ); |
| 73 | + return $params; |
| 74 | + } |
| 75 | + |
| 76 | + /** |
57 | 77 | * Displays a form section showing the options for a given format, |
58 | 78 | * based on the getParameters() value for that format's query printer. |
59 | 79 | * |