r109002 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109001‎ | r109002 | r109003 >
Date:21:25, 15 January 2012
Author:vasilievvv
Status:ok (Comments)
Tags:miscextensions 
Comment:
Allow ImageMap to output maps without any links.

I see no reason why we would want to disallow such behavior, and in some cases it may be useful (I'm told that this simplifies significantly one of ruwiki's map templates).
Modified paths:
  • /trunk/extensions/ImageMap/ImageMap.i18n.php (modified) (history)
  • /trunk/extensions/ImageMap/ImageMap_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ImageMap/ImageMap_body.php
@@ -243,9 +243,7 @@
244244 return self::error( 'imagemap_no_image' );
245245 }
246246
247 - if ( $mapHTML == '' && $defaultLinkAttribs == '' ) {
248 - return self::error( 'imagemap_no_areas' );
249 - } elseif ( $mapHTML == '' && $defaultLinkAttribs != '' ) {
 247+ if ( $mapHTML == '' ) {
250248 // no areas defined, default only. It's not a real imagemap, so we do not need some tags
251249 $realmap = false;
252250 }
Index: trunk/extensions/ImageMap/ImageMap.i18n.php
@@ -20,7 +20,6 @@
2121 'imagemap_invalid_title' => 'Error: invalid title in link at line $1',
2222 'imagemap_missing_coord' => 'Error: not enough coordinates for shape at line $1',
2323 'imagemap_unrecognised_shape' => 'Error: unrecognised shape at line $1, each line must start with one of: default, rect, circle or poly',
24 - 'imagemap_no_areas' => 'Error: at least one area specification must be given',
2524 'imagemap_invalid_coord' => 'Error: invalid coordinate at line $1, must be a number',
2625 'imagemap_invalid_desc' => 'Error: invalid desc specification, must be one of: <code>$1</code>',
2726 'imagemap_description' => 'About this image',

Sign-offs

UserFlagDate
Reedyinspected19:45, 27 January 2012
Reedytested19:45, 27 January 2012

Comments

#Comment by Raymond (talk | contribs)   21:36, 15 January 2012

You wrote: I'm told that this simplifies significantly one of ruwiki's map templates

Just curious: Could you give an example pls? Why do they create an imagemap if no area is defined to click?

#Comment by VasilievVV (talk | contribs)   21:53, 15 January 2012

It's simple. If you have a map template ( https://ru.wikipedia.org/w/index.php?title=%D0%A8%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD:%D0%9F%D0%BE%D0%B7%D0%9A%D0%B0%D1%80%D1%82%D0%B0%2B&oldid=40273285&action=edit ), you would want to pass areas as an argument (to linkify the regions on the map). If you do not have those regions (say, they are not applicable, or not mapified yet), you have an empty image map.

Status & tagging log