r72981 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72980‎ | r72981 | r72982 >
Date:15:49, 14 September 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.7 - updated query printers to use Validator 0.4
Modified paths:
  • /trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php (modified) (history)
  • /trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_QueryPrinters.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_QueryPrinters.php
@@ -111,7 +111,7 @@
112112 'limit' => array(
113113 'type' => 'integer',
114114 'criteria' => array(
115 - 'in_range' => array( 0 )
 115+ 'in_range' => array( 0, false )
116116 )
117117 ),
118118 'offset' => array(
Index: trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php
@@ -1,7 +1,7 @@
22 <?php
33
44 /**
5 - * File holding abstract class SMMapPrinter.
 5+ * Abstract class that provides the common functionality for all map query printers.
66 *
77 * @file SM_MapPrinter.php
88 * @ingroup SemanticMaps
@@ -10,22 +10,6 @@
1111 * @author Robert Buzink
1212 * @author Yaron Koren
1313 */
14 -
15 -if ( !defined( 'MEDIAWIKI' ) ) {
16 - die( 'Not an entry point.' );
17 -}
18 -
19 -/**
20 - * Abstract class that provides the common functionality for all map query printers.
21 - *
22 - * @ingroup SemanticMaps
23 - *
24 - * @author Jeroen De Dauw
25 - * @author Robert Buzink
26 - * @author Yaron Koren
27 - *
28 - * The adaptor pattern could be used to prevent this.
29 - */
3014 abstract class SMMapPrinter extends SMWResultPrinter implements iMappingFeature {
3115
3216 /**
@@ -66,11 +50,6 @@
6751 * @var string
6852 */
6953 protected $output = '';
70 -
71 - /**
72 - * @var string
73 - */
74 - protected $errorList;
7554
7655 /**
7756 * @var array
@@ -161,7 +140,7 @@
162141 }
163142 }
164143
165 - return array( $this->output . $this->errorList, 'noparse' => true, 'isHTML' => true );
 144+ return array( $this->output, 'noparse' => true, 'isHTML' => true );
166145 }
167146
168147 /**
@@ -184,16 +163,19 @@
185164 $parameterInfo = array_merge_recursive( $parameterInfo, $this->service->getParameterInfo() );
186165 $parameterInfo = array_merge_recursive( $parameterInfo, $this->getSpecificParameterInfo() );
187166
188 - $manager = new ValidationManager();
 167+ $this->validator = new Validator( $this->getName() );
189168
190 - $showMap = $manager->manageParsedParameters( $mapProperties, $parameterInfo );
 169+ $this->validator->setParameters( $mapProperties, $parameterInfo );
191170
 171+ $this->validator->validateParameters();
 172+
 173+ $showMap = $this->validator->hasFatalError();
 174+
192175 if ( $showMap ) {
193 - $this->setMapProperties( $manager->getParameters( false ) );
 176+ $this->validator->formatParameters();
 177+ $this->setMapProperties( $this->validator->getParameterValues() );
194178 }
195179
196 - $this->errorList = $manager->getErrorList();
197 -
198180 return $showMap;
199181 }
200182

Status & tagging log