r94605 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94604‎ | r94605 | r94606 >
Date:06:59, 16 August 2011
Author:devayon
Status:deferred
Tags:
Comment:
fixed broken code. Broke because of use of Xml::hidden()
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php
@@ -47,7 +47,6 @@
4848 * @global WebRequest $wgRequest
4949 * @global boolean $smwgQEnabled
5050 * @param string $p the sub-page string
51 - * @todo: using processXXXBox() methods here goes against the general architecture. Move this to the UI implementation
5251 */
5352 public function execute( $p ) {
5453 global $wgOut, $wgRequest, $smwgQEnabled, $wgFeedClasses;
@@ -63,13 +62,7 @@
6463 // the 'q' is dependent from the form parameter set by getQueryFormBox()
6564 // and processQueryFormBox()
6665 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();
7467 $this->uiCore = SMWQueryUIHelper::makeForUI(
7568 $this->processQueryFormBox( $wgRequest ),
7669 $params,
@@ -84,10 +77,10 @@
8578 $this->uiCore = SMWQueryUIHelper::makeForInfoLink( $p );
8679 }
8780 // 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 ) ) ) {
9285 $res = $this->uiCore->getResultObject();
9386 $link = $res->getQueryLink();
9487 $link->setParameter( 'rss', 'format' );
@@ -103,6 +96,16 @@
10497 }
10598
10699 /**
 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+ /**
107110 * To enable/disable syndicated feeds of results to appear in the UI header
108111 *
109112 * @return boolean
@@ -691,19 +694,19 @@
692695 $result .= Xml::checkLabel( wfMsg( 'smw_qui_shownresults' ), "display[$i]", "display$i", $if4 );
693696
694697 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" ) );
696699 } 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" ) );
698701 }
699702 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" ) );
701704 } 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" ) );
703706 }
704707 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" ) );
706709 } 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" ) );
708711 }
709712 $result .= ' <a id="more' . $i . '" "class="smwq-more" href="javascript:smw_makePropDialog(\'' . $i . '\')"> ' . WfMsg( 'smw_qui_options' ) . ' </a> ';
710713
@@ -753,9 +756,9 @@
754757 Xml::option( wfMsg( 'smw_qui_ascorder' ), 'ASC' ) .
755758 Xml::option( wfMsg( 'smw_qui_descorder' ), 'DESC' ) .
756759 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', '' ) .
760763 Xml::checkLabel( wfMsg( 'smw_qui_shownresults' ), "display_num", '', true ) .
761764 Xml::closeElement( 'div' );
762765 $hiddenProperty = json_encode( $hiddenProperty );
Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php
@@ -53,6 +53,26 @@
5454 }
5555
5656 /**
 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+ /**
5777 * Displays a form section showing the options for a given format,
5878 * based on the getParameters() value for that format's query printer.
5979 *