r75352 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75351‎ | r75352 | r75353 >
Date:13:31, 25 October 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.7.2 - follow up to r75351
Modified paths:
  • /trunk/extensions/Maps/Maps.i18n.php (modified) (history)
  • /trunk/extensions/Maps/includes/Maps_LayerPage.php (modified) (history)
  • /trunk/extensions/Maps/includes/Maps_Layers.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Maps.i18n.php
@@ -29,6 +29,7 @@
3030 'maps-layer-errors' => 'Errors',
3131 'maps-error-invalid-layerdef' => 'This layer definition is not valid.',
3232 'maps-error-invalid-layertype' => 'There are no layers of type "$1". Only {{PLURAL:$3|this type is|these types are}} supported: $2',
 33+ 'maps-error-no-layertype' => 'You need to specify the layer type. {{PLURAL:$2|Only this type is|These types are}} supported: $1',
3334 'validation-error-invalid-layer' => 'Parameter $1 must be a valid layer.',
3435 'validation-error-invalid-layers' => 'Parameter $1 must be one or more valid layers.',
3536
Index: trunk/extensions/Maps/includes/Maps_LayerPage.php
@@ -53,33 +53,54 @@
5454
5555 $wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
5656
57 - if ( MapsLayers::hasLayer( $this->getLayerType() ) ) {
58 - $this->displayLayerDefinition( MapsLayers::getLayer( $this->getLayerType() ) );
 57+ if ( $this->exists() ) {
 58+ $layerType = $this->getLayerType();
 59+
 60+ if ( $layerType !== false && MapsLayers::hasLayer( $layerType ) ) {
 61+ $this->displayLayerDefinition();
 62+ }
 63+ else {
 64+ global $wgLang;
 65+ $availableLayerTypes = MapsLayers::getAvailableLayers();
 66+
 67+ if ( $layerType === false ) {
 68+ $wgOut->addHTML(
 69+ '<span class="errorbox">' .
 70+ htmlspecialchars( wfMsgExt(
 71+ 'maps-error-no-layertype',
 72+ 'parsemag',
 73+ $wgLang->listToText( $availableLayerTypes ),
 74+ count( $availableLayerTypes )
 75+ ) ) .
 76+ '</span><br />'
 77+ );
 78+ }
 79+ else {
 80+ $wgOut->addHTML(
 81+ '<span class="errorbox">' .
 82+ htmlspecialchars( wfMsgExt(
 83+ 'maps-error-invalid-layertype',
 84+ 'parsemag',
 85+ $this->getLayerType(),
 86+ $wgLang->listToText( $availableLayerTypes ),
 87+ count( $availableLayerTypes )
 88+ ) ) .
 89+ '</span><br />'
 90+ );
 91+ }
 92+ }
5993 }
60 - else {
61 - $availableLayerTypes = MapsLayers::getAvailableLayers();
62 - $wgOut->addHTML(
63 - '<span class="errorbox">' .
64 - htmlspecialchars( wfMsgExt(
65 - 'maps-error-invalid-layertype',
66 - 'parsemag',
67 - $this->getLayerType(),
68 - $availableLayerTypes,
69 - count( $availableLayerTypes )
70 - ) ) .
71 - '</span><br />'
72 - );
73 - }
7494 }
7595
7696 /**
7797 * Displays the layer definition as a table.
7898 *
7999 * @since 0.7.2
80 - *
81 - * @param MapsLayer $layer
82100 */
83 - protected function displayLayerDefinition( MapsLayer $layer ) {
 101+ protected function displayLayerDefinition() {
 102+ global $wgOut;
 103+
 104+ $layer = $this->getLayer();
84105 $errorHeader = '';
85106
86107 if ( !$layer->isValid() ) {
Index: trunk/extensions/Maps/includes/Maps_Layers.php
@@ -92,7 +92,7 @@
9393 */
9494 public static function hasLayer( $type, $service = null ) {
9595 self::initializeLayers();
96 -
 96+
9797 if ( array_key_exists( $type, self::$classes ) && array_key_exists( $type, self::$services ) ) {
9898 return is_null( $service ) || in_array( $service, self::$services[$type] );
9999 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75351Extended layer handling to have multiple types of layers, each of which can b...jeroendedauw12:45, 25 October 2010

Status & tagging log