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

Revision: 97482
Author:   jeroendedauw
Date:     2011-09-19 13:00:01 +0000 (Mon, 19 Sep 2011)
Log Message:
-----------
Follow up to r97479; 

Modified Paths:
--------------
    trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php
    trunk/extensions/SemanticMediaWiki/includes/api/ApiSMWQuery.php
    trunk/extensions/SemanticMediaWiki/includes/params/SMW_ParamFormat.php
    trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php

Removed Paths:
-------------
    trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Auto.php

Modified: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php  
2011-09-19 12:58:54 UTC (rev 97481)
+++ trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php  
2011-09-19 13:00:01 UTC (rev 97482)
@@ -81,6 +81,10 @@
                $qp->setDefaultNamespaces( $smwgQDefaultNamespaces );
                $desc = $qp->getQueryDescription( $querystring );
 
+               if ( $format === '' ) {
+                       $format = $params['format'];
+               }
+               
                if ( $format == 'count' ) {
                        $querymode = SMWQuery::MODE_COUNT;
                } elseif ( $format == 'debug' ) {

Modified: trunk/extensions/SemanticMediaWiki/includes/api/ApiSMWQuery.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/api/ApiSMWQuery.php     
2011-09-19 12:58:54 UTC (rev 97481)
+++ trunk/extensions/SemanticMediaWiki/includes/api/ApiSMWQuery.php     
2011-09-19 13:00:01 UTC (rev 97482)
@@ -23,21 +23,13 @@
        protected $parameters;
        
        /**
-        * Query printeouts.
         * 
-        * @since 1.6.2
-        * @var array
-        */
-       protected $printeouts;
-       
-       /**
-        * 
         * @return SMWQuery
         */
        protected function getQuery( $queryString, array $printeouts ) {
                return SMWQueryProcessor::createQuery(
                        $queryString,
-                       SMWQueryProcessor::getProcessedParams( 
$this->parameters ),
+                       SMWQueryProcessor::getProcessedParams( 
$this->parameters, $printeouts ),
                        SMWQueryProcessor::SPECIAL_PAGE,
                        '',
                        $printeouts

Modified: trunk/extensions/SemanticMediaWiki/includes/params/SMW_ParamFormat.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/params/SMW_ParamFormat.php      
2011-09-19 12:58:54 UTC (rev 97481)
+++ trunk/extensions/SemanticMediaWiki/includes/params/SMW_ParamFormat.php      
2011-09-19 13:00:01 UTC (rev 97482)
@@ -46,10 +46,6 @@
                // Add the formats parameters to the parameter list.
                $queryPrinter = SMWQueryProcessor::getResultPrinter( $value );
                
-               if ( $queryPrinter instanceof SMWAutoResultPrinter ) {
-                       $queryPrinter->determineFormat();
-               }
-               
                $parameters = array_merge( $parameters, 
$queryPrinter->getValidatorParameters() );
        }
        

Deleted: 
trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Auto.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Auto.php   
2011-09-19 12:58:54 UTC (rev 97481)
+++ trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Auto.php   
2011-09-19 13:00:01 UTC (rev 97482)
@@ -1,97 +0,0 @@
-<?php
-/**
- * Print query results in tables or lists, depending on their shape.
- * This implements the automatic printer selection used in SMW if no
- * query format is specified.
- * 
- * @file
- * @ingroup SMWQuery
- * 
- * @author Markus Krötzsch
- * @author Jeroen De Dauw
- */
-
-/**
- * New implementation of SMW's printer for automatically selecting the
- * format for printing a result.
- *
- * @ingroup SMWQuery
- */
-class SMWAutoResultPrinter extends SMWResultPrinter {
-
-       protected $format = false;
-       
-       /**
-        * @see SMWResultPrinter::getResult
-        * 
-        * @param $results SMWQueryResult
-        * @param $params array
-        * @param $outputmode integer
-        * 
-        * @return string
-        */
-       public function getResult( SMWQueryResult $results, array $params, 
$outputmode ) {
-               $this->determineFormat( $results, $params );
-               
-               $printer = SMWQueryProcessor::getResultPrinter(
-                       $this->format,
-                       $this->mInline ? SMWQueryProcessor::INLINE_QUERY : 
SMWQueryProcessor::SPECIAL_PAGE
-               );
-               
-               return $printer->getResult( $results, $params, $outputmode );
-       }
-
-       /**
-        * @see SMWResultPrinter::getResultText
-        * 
-        * @param SMWQueryResult $res
-        * @param $outputmode
-        */
-       protected function getResultText( SMWQueryResult $res, $outputmode ) {
-               return ''; // acutally not needed in this implementation
-       }
-
-       public function getName() {
-               smwfLoadExtensionMessages( 'SemanticMediaWiki' );
-               return wfMsg( 'smw_printername_auto' );
-       }
-       
-       /**
-        * (non-PHPdoc)
-        * @see SMWResultPrinter::getParameters()
-        * 
-        * To work correctly as of 1.6.2, you need to call determineFormat 
first. 
-        */
-       public function getParameters() {
-               $printer = SMWQueryProcessor::getResultPrinter(
-                       $this->format,
-                       $this->mInline ? SMWQueryProcessor::INLINE_QUERY : 
SMWQueryProcessor::SPECIAL_PAGE
-               );
-               
-               return $printer->getParameters();
-       }
-       
-       /**
-        * Determine the format, based on the result and provided parameters.
-        * 
-        * @since 1.6.2
-        * 
-        * @param SMWQueryResult $results
-        * @param array $params
-        * 
-        * @return string
-        */
-       public function determineFormat( SMWQueryResult $results = null, array 
$params = null ) {
-               if ( $this->format === false ) {
-                       if ( is_null( $results ) || is_null( $params ) ) {
-                               $this->format = 'table';
-                       }
-                       else {
-
-                       }
-               }
-               
-               return $this->format;
-       }
-
-}

Modified: 
trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php   
2011-09-19 12:58:54 UTC (rev 97481)
+++ trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php   
2011-09-19 13:00:01 UTC (rev 97482)
@@ -370,7 +370,7 @@
                if ( array_key_exists( 'order', $this->m_params ) ) 
$urlArgs['order'] = $this->m_params['order'];
 
                if ( $this->m_querystring != '' ) {
-                       $params = SMWQueryProcessor::getProcessedParams( 
$this->m_params );
+                       $params = SMWQueryProcessor::getProcessedParams( 
$this->m_params, $this->m_printouts );
                        $this->m_params['format'] = $params['format'];
                        
                        $queryobj = SMWQueryProcessor::createQuery(


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to