r72983 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72982‎ | r72983 | r72984 >
Date:15:53, 14 September 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.7 - updated form inputs to use Validator 0.4
Modified paths:
  • /trunk/extensions/SemanticMaps/Features/FormInputs/SM_FormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/Features/FormInputs/SM_FormInput.php
@@ -43,11 +43,6 @@
4444 protected $markerCoords;
4545
4646 /**
47 - * @var string
48 - */
49 - protected $errorList;
50 -
51 - /**
5247 * Parameters specific to this feature.
5348 *
5449 * @var mixed
@@ -117,12 +112,16 @@
118113 $parameterInfo = array_merge_recursive( $parameterInfo, $this->service->getParameterInfo() );
119114 $parameterInfo = array_merge_recursive( $parameterInfo, $this->getSpecificParameterInfo() );
120115
121 - $manager = new ValidationManager();
122 -
123 - $showMap = $manager->manageParsedParameters( $mapProperties, $parameterInfo );
 116+ $validator = new Validator( 'form' ); // TODO
124117
 118+ $validator->setParameters( $mapProperties, $parameterInfo );
 119+
 120+ $validator->validateParameters();
 121+
 122+ $showMap = $validator->hasFatalError();
 123+
125124 if ( $showMap ) {
126 - $parameters = $manager->getParameters( false );
 125+ $parameters = $validator->getParameterValues();
127126
128127 foreach ( $parameters as $paramName => $paramValue ) {
129128 if ( !property_exists( __CLASS__, $paramName ) ) {
@@ -135,8 +134,6 @@
136135 }
137136 }
138137
139 - $this->errorList = $manager->getErrorList();
140 -
141138 return $showMap;
142139 }
143140
@@ -156,7 +153,7 @@
157154 $showInput = $this->setMapProperties( $field_args );
158155
159156 if ( !$showInput ) {
160 - return array( $this->errorList );
 157+ return array( '' );
161158 }
162159
163160 $this->setCoordinates();
Index: trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php
@@ -163,17 +163,17 @@
164164 $parameterInfo = array_merge_recursive( $parameterInfo, $this->service->getParameterInfo() );
165165 $parameterInfo = array_merge_recursive( $parameterInfo, $this->getSpecificParameterInfo() );
166166
167 - $this->validator = new Validator( $this->getName() );
 167+ $validator = new Validator( $this->getName() );
168168
169 - $this->validator->setParameters( $mapProperties, $parameterInfo );
 169+ $validator->setParameters( $mapProperties, $parameterInfo );
170170
171 - $this->validator->validateParameters();
 171+ $validator->validateParameters();
172172
173 - $showMap = $this->validator->hasFatalError();
 173+ $showMap = $validator->hasFatalError();
174174
175175 if ( $showMap ) {
176 - $this->validator->formatParameters();
177 - $this->setMapProperties( $this->validator->getParameterValues() );
 176+ $validator->formatParameters();
 177+ $this->setMapProperties( $validator->getParameterValues() );
178178 }
179179
180180 return $showMap;

Status & tagging log