http://www.mediawiki.org/wiki/Special:Code/MediaWiki/94605

Revision: 94605
Author:   devayon
Date:     2011-08-16 06:59:35 +0000 (Tue, 16 Aug 2011)
Log Message:
-----------
fixed broken code. Broke because of use of  Xml::hidden()

Modified Paths:
--------------
    trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php
    
trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php

Modified: 
trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php
===================================================================
--- 
trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php    
    2011-08-16 06:59:18 UTC (rev 94604)
+++ 
trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php    
    2011-08-16 06:59:35 UTC (rev 94605)
@@ -47,7 +47,6 @@
         * @global WebRequest $wgRequest
         * @global boolean $smwgQEnabled
         * @param string $p the sub-page string
-        * @todo: using processXXXBox() methods here goes against the general 
architecture. Move this to the UI implementation
         */
        public function execute( $p ) {
                global $wgOut, $wgRequest, $smwgQEnabled, $wgFeedClasses;
@@ -63,13 +62,7 @@
                                // the 'q' is dependent from the form parameter 
set by getQueryFormBox()
                                // and processQueryFormBox()
                                if ( $wgRequest->getCheck( 'q' ) ) {
-                                       $params = array_merge(
-                                                       array(
-                                                       'format'  =>  
$wgRequest->getVal( 'format' ),
-                                                       'offset'  =>  
$wgRequest->getVal( 'offset',  '0'  ),
-                                                       'limit'   =>  
$wgRequest->getVal( 'limit',   '20' ) ),
-                                                       
$this->processPoSortFormBox( $wgRequest ),
-                                                       
$this->processFormatSelectBox( $wgRequest ) );
+                                       $params = $this->processParams();
                                        $this->uiCore =  
SMWQueryUIHelper::makeForUI(
                                                        
$this->processQueryFormBox( $wgRequest ),
                                                        $params,
@@ -84,10 +77,10 @@
                                        $this->uiCore =  
SMWQueryUIHelper::makeForInfoLink( $p );
                                }
                                // adding rss feed of results to the page head
-                               if ( ( $this->uiCore->getQueryString() !== '' )
-                                               and ( $this->isSyndicated() )
-                                               and ( method_exists( $wgOut, 
'addFeedlink' ) ) // remove this line after MW 1.5 is no longer supported by SMW
-                                               and ( array_key_exists( 'rss', 
$wgFeedClasses ) ) ) {
+                               if ( ( $this->isSyndicated() )
+                                               && ( 
$this->uiCore->getQueryString() !== '' )
+                                               && ( method_exists( $wgOut, 
'addFeedlink' ) ) // remove this line after MW 1.5 is no longer supported by SMW
+                                               && ( array_key_exists( 'rss', 
$wgFeedClasses ) ) ) {
                                        $res = $this->uiCore->getResultObject();
                                        $link = $res->getQueryLink();
                                        $link->setParameter( 'rss', 'format' );
@@ -103,6 +96,16 @@
        }
 
        /**
+        * This method should call the various processXXXBox() methods for each 
of
+        * the corresponding getXXXBox() methods which the UI uses.
+        * Merge the results of these methods and return them.
+        *
+        * @global WebRequest $wgRequest
+        * @return array
+        */
+       protected abstract function processParams();
+
+       /**
         * To enable/disable syndicated feeds of results to appear in the UI 
header
         *
         * @return boolean
@@ -691,19 +694,19 @@
                                $result .= Xml::checkLabel( wfMsg( 
'smw_qui_shownresults' ), "display[$i]", "display$i", $if4 );
 
                                if ( is_array( $propertyLabelValues ) && 
array_key_exists( $key, $propertyLabelValues ) ) {
-                                       $result .= Xml::hidden( 
"prop_label[$i]", $propertyLabelValues[$key], array( 'id' => "prop_label$i" ) );
+                                       $result .= Html::hidden( 
"prop_label[$i]", $propertyLabelValues[$key], array( 'id' => "prop_label$i" ) );
                                } else {
-                                       $result .= Xml::hidden( 
"prop_label[$i]", '', array( 'id' => "prop_label$i" ) );
+                                       $result .= Html::hidden( 
"prop_label[$i]", '', array( 'id' => "prop_label$i" ) );
                                }
                                if ( is_array( $propertyFormatValues ) && 
array_key_exists( $key, $propertyFormatValues ) ) {
-                                       $result .= Xml::hidden( 
"prop_format[$i]", $propertyFormatValues[$key], array( 'id' => "prop_format$i" 
) );
+                                       $result .= Html::hidden( 
"prop_format[$i]", $propertyFormatValues[$key], array( 'id' => "prop_format$i" 
) );
                                } else {
-                                       $result .= Xml::hidden( 
"prop_format[$i]", '', array( 'id' => "prop_format$i" ) );
+                                       $result .= Html::hidden( 
"prop_format[$i]", '', array( 'id' => "prop_format$i" ) );
                                }
                                if ( is_array( $propertyLimitValues ) && 
array_key_exists( $key, $propertyLimitValues ) ) {
-                                       $result .= Xml::hidden( 
"prop_limit[$i]", $propertyLimitValues[$key], array( 'id' => "prop_limit$i" ) );
+                                       $result .= Html::hidden( 
"prop_limit[$i]", $propertyLimitValues[$key], array( 'id' => "prop_limit$i" ) );
                                } else {
-                                       $result .= Xml::hidden( 
"prop_limit[$i]", '', array( 'id' => "prop_limit$i" ) );
+                                       $result .= Html::hidden( 
"prop_limit[$i]", '', array( 'id' => "prop_limit$i" ) );
                                }
                                $result .= ' <a  id="more' . $i . '" 
"class="smwq-more" href="javascript:smw_makePropDialog(\'' . $i . '\')"> ' . 
WfMsg( 'smw_qui_options' ) . ' </a> ';
 
@@ -753,9 +756,9 @@
                                                Xml::option( wfMsg( 
'smw_qui_ascorder' ), 'ASC' ) .
                                                Xml::option( wfMsg( 
'smw_qui_descorder' ), 'DESC' ) .
                                        Xml::closeElement( 'select' ) .
-                                       Xml::hidden( 'prop_label_num', '' ) .
-                                       Xml::hidden( 'prop_format_num', '' ) .
-                                       Xml::hidden( 'prop_limit_num', '' ) .
+                                       Html::hidden( 'prop_label_num', '' ) .
+                                       Html::hidden( 'prop_format_num', '' ) .
+                                       Html::hidden( 'prop_limit_num', '' ) .
                                        Xml::checkLabel( wfMsg( 
'smw_qui_shownresults' ), "display_num", '', true ) .
                                        Xml::closeElement( 'div' );
                $hiddenProperty = json_encode( $hiddenProperty );

Modified: 
trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php
===================================================================
--- 
trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php
  2011-08-16 06:59:18 UTC (rev 94604)
+++ 
trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php
  2011-08-16 06:59:35 UTC (rev 94605)
@@ -53,6 +53,26 @@
        }
 
        /**
+        * This method should call the various processXXXBox() methods for each 
of
+        * the corresponding getXXXBox() methods which the UI uses.
+        * Merge the results of these methods and return them.
+        *
+        * @global WebRequest $wgRequest
+        * @return array
+        */
+       protected function processParams(){
+               global $wgRequest;
+               $params = array_merge(
+                                                       array(
+                                                       'format'  =>  
$wgRequest->getVal( 'format' ),
+                                                       'offset'  =>  
$wgRequest->getVal( 'offset',  '0'  ),
+                                                       'limit'   =>  
$wgRequest->getVal( 'limit',   '20' ) ),
+                                                       
$this->processPoSortFormBox( $wgRequest ),
+                                                       
$this->processFormatSelectBox( $wgRequest ) );
+               return $params;
+       }
+
+       /**
         * Displays a form section showing the options for a given format,
         * based on the getParameters() value for that format's query printer.
         *


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to