r81252 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81251‎ | r81252 | r81253 >
Date:15:07, 31 January 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Allow 'auto' as width and use it as default
Modified paths:
  • /trunk/extensions/Maps/Maps.php (modified) (history)
  • /trunk/extensions/Maps/Maps_Settings.php (modified) (history)
  • /trunk/extensions/Maps/includes/criteria/CriterionMapDimension.php (modified) (history)
  • /trunk/extensions/Maps/includes/manipulations/Maps_ParamDimension.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Maps.php
@@ -36,7 +36,7 @@
3737 die( '<b>Error:</b> You need to have <a href="http://www.mediawiki.org/wiki/Extension:Validator">Validator</a> installed in order to use <a href="http://www.mediawiki.org/wiki/Extension:Maps">Maps</a>.<br />' );
3838 }
3939 else {
40 - define( 'Maps_VERSION', '0.7.4' );
 40+ define( 'Maps_VERSION', '0.7.5 alpha' );
4141
4242 // The different coordinate notations.
4343 define( 'Maps_COORDS_FLOAT', 'float' );
Index: trunk/extensions/Maps/Maps_Settings.php
@@ -208,7 +208,7 @@
209209
210210 # Integer or string. The default width and height of a map. These values will
211211 # only be used when the user does not provide them.
212 - $egMapsMapWidth = '100%';
 212+ $egMapsMapWidth = 'auto';
213213 $egMapsMapHeight = 350;
214214
215215 # Array. The minimum and maximum width and height for all maps. First min and
Index: trunk/extensions/Maps/includes/manipulations/Maps_ParamDimension.php
@@ -39,8 +39,12 @@
4040 * @since 0.7
4141 */
4242 public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
43 - global $egMapsSizeRestrictions;
 43+ global $egMapsSizeRestrictions, $egMapsMapWidth, $egMapsMapHeight;
4444
 45+ if ( $value == 'auto' && $this->dimension == 'width' ) {
 46+ return;
 47+ }
 48+
4549 // Set the default if the value is not valid.
4650 if ( !preg_match( '/^\d+(\.\d+)?(px|ex|em|%)?$/', $value ) ) {
4751 $value = $this->dimension == 'width' ? $egMapsMapWidth : $egMapsMapHeight;
Index: trunk/extensions/Maps/includes/criteria/CriterionMapDimension.php
@@ -39,6 +39,10 @@
4040 protected function doValidation( $value, Parameter $parameter, array $parameters ) {
4141 global $egMapsSizeRestrictions;
4242
 43+ if ( $value == 'auto' && $this->dimension == 'width' ) {
 44+ return true;
 45+ }
 46+
4347 // See if the notation is valid.
4448 if ( !preg_match( '/^\d+(\.\d+)?(px|ex|em|%)?$/', $value ) ) {
4549 return false;

Follow-up revisions

RevisionCommit summaryAuthorDate
r81253Follow up to r81252, update branch as welljeroendedauw15:08, 31 January 2011

Status & tagging log